diff options
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/dialog/dialcontrol.cxx | 42 | ||||
-rw-r--r-- | svx/source/sidebar/possize/SidebarDialControl.cxx | 7 | ||||
-rw-r--r-- | svx/source/sidebar/possize/SidebarDialControlBmp.cxx | 87 | ||||
-rw-r--r-- | svx/source/sidebar/possize/SidebarDialControlBmp.hxx | 43 |
4 files changed, 28 insertions, 151 deletions
diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx index 40c818e883ce..5ebb3964d4fa 100644 --- a/svx/source/dialog/dialcontrol.cxx +++ b/svx/source/dialog/dialcontrol.cxx @@ -72,23 +72,37 @@ void DialControlBmp::DrawBackground( const Size& rSize, bool bEnabled ) void DialControlBmp::DrawElements( const String& rText, sal_Int32 nAngle ) { - // *** rotated text *** - - Font aFont( GetFont() ); - aFont.SetColor( GetTextColor() ); - aFont.SetOrientation( static_cast< short >( (nAngle + 5) / 10 ) ); // Font uses 1/10 degrees - aFont.SetWeight( WEIGHT_BOLD ); - SetFont( aFont ); - double fAngle = nAngle * F_PI180 / 100.0; double fSin = sin( fAngle ); double fCos = cos( fAngle ); double fWidth = GetTextWidth( rText ) / 2.0; double fHeight = GetTextHeight() / 2.0; - long nX = static_cast< long >( mnCenterX - fWidth * fCos - fHeight * fSin ); - long nY = static_cast< long >( mnCenterY + fWidth * fSin - fHeight * fCos ); - Rectangle aRect( nX, nY, 2 * mnCenterX - nX, 2 * mnCenterY - nY ); - DrawText( aRect, rText, mbEnabled ? 0 : TEXT_DRAW_DISABLE ); + + if ( rText.Len() > 0 ) + { + // rotated text + Font aFont( GetFont() ); + aFont.SetColor( GetTextColor() ); + aFont.SetOrientation( static_cast< short >( (nAngle + 5) / 10 ) ); // Font uses 1/10 degrees + aFont.SetWeight( WEIGHT_BOLD ); + SetFont( aFont ); + + long nX = static_cast< long >( mnCenterX - fWidth * fCos - fHeight * fSin ); + long nY = static_cast< long >( mnCenterY + fWidth * fSin - fHeight * fCos ); + Rectangle aRect( nX, nY, 2 * mnCenterX - nX, 2 * mnCenterY - nY ); + DrawText( aRect, rText, mbEnabled ? 0 : TEXT_DRAW_DISABLE ); + } + else + { + // only a line + const sal_Int32 nDx (fCos * (maRect.GetWidth()-4) / 2); + const sal_Int32 nDy (-fSin * (maRect.GetHeight()-4) / 2); + Point pt1( maRect.Center() ); + Point pt2( pt1.X() + nDx, pt1.Y() + nDy); + + SetLineColor( GetTextColor() ); + DrawLine( pt1, pt2 ); + } // *** drag button *** @@ -96,8 +110,8 @@ void DialControlBmp::DrawElements( const String& rText, sal_Int32 nAngle ) SetLineColor( GetButtonLineColor() ); SetFillColor( GetButtonFillColor( bMain ) ); - nX = mnCenterX - static_cast< long >( (DIAL_OUTER_WIDTH / 2 - mnCenterX) * fCos ); - nY = mnCenterY - static_cast< long >( (mnCenterY - DIAL_OUTER_WIDTH / 2) * fSin ); + long nX = mnCenterX - static_cast< long >( (DIAL_OUTER_WIDTH / 2 - mnCenterX) * fCos ); + long nY = mnCenterY - static_cast< long >( (mnCenterY - DIAL_OUTER_WIDTH / 2) * fSin ); long nSize = bMain ? (DIAL_OUTER_WIDTH / 4) : (DIAL_OUTER_WIDTH / 2 - 1); DrawEllipse( Rectangle( nX - nSize, nY - nSize, nX + nSize, nY + nSize ) ); } diff --git a/svx/source/sidebar/possize/SidebarDialControl.cxx b/svx/source/sidebar/possize/SidebarDialControl.cxx index a6611b722184..d7c80e900b9d 100644 --- a/svx/source/sidebar/possize/SidebarDialControl.cxx +++ b/svx/source/sidebar/possize/SidebarDialControl.cxx @@ -16,7 +16,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include <svx/sidebar/SidebarDialControl.hxx> -#include "SidebarDialControlBmp.hxx" #include <vcl/svapp.hxx> @@ -25,9 +24,6 @@ namespace svx { namespace sidebar { SidebarDialControl::SidebarDialControl (Window* pParent, WinBits nBits) : svx::DialControl(pParent, nBits) { - mpImpl->mpBmpEnabled.reset(new SidebarDialControlBmp(*this)); - mpImpl->mpBmpDisabled.reset(new SidebarDialControlBmp(*this)); - mpImpl->mpBmpBuffered.reset(new SidebarDialControlBmp(*this)); Init(GetOutputSizePixel()); } @@ -41,9 +37,6 @@ SidebarDialControl::SidebarDialControl ( const ResId& rResId) : svx::DialControl(pParent, rResId) { - mpImpl->mpBmpEnabled.reset(new SidebarDialControlBmp(*this)); - mpImpl->mpBmpDisabled.reset(new SidebarDialControlBmp(*this)); - mpImpl->mpBmpBuffered.reset(new SidebarDialControlBmp(*this)); Init(GetOutputSizePixel()); } diff --git a/svx/source/sidebar/possize/SidebarDialControlBmp.cxx b/svx/source/sidebar/possize/SidebarDialControlBmp.cxx deleted file mode 100644 index f702632250a2..000000000000 --- a/svx/source/sidebar/possize/SidebarDialControlBmp.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include "SidebarDialControlBmp.hxx" - -#include <sfx2/sidebar/Theme.hxx> - -#include <vcl/svapp.hxx> - -#include "PosSizePropertyPanel.hrc" -#include <svx/dialogs.hrc> -#include <svx/dialmgr.hxx> -#include <svx/svdstr.hrc> - -namespace svx { namespace sidebar { - -SidebarDialControlBmp::SidebarDialControlBmp (Window& rParent) - : DialControlBmp(rParent) -{ -} - - - - -SidebarDialControlBmp::~SidebarDialControlBmp (void) -{ -} - - - - -void SidebarDialControlBmp::DrawElements ( - const String& /*rText*/, - sal_Int32 nAngle) -{ - if (Application::GetSettings().GetLayoutRTL()) - nAngle = 18000 - nAngle; - double fAngle = nAngle * F_PI180 / 100.0; - double fSin = sin( fAngle ); - double fCos = cos( fAngle ); - DrawText( maRect, String(), mbEnabled ? 0 : TEXT_DRAW_DISABLE ); - const sal_Int32 nDx (fCos * (maRect.GetWidth()-4) / 2); - const sal_Int32 nDy (-fSin * (maRect.GetHeight()-4) / 2); - Point pt1( maRect.Center() ); - Point pt2( pt1.X() + nDx, pt1.Y() + nDy); - if ( ! sfx2::sidebar::Theme::IsHighContrastMode()) - SetLineColor( Color( 60, 93, 138 ) ); - else - SetLineColor(COL_BLACK);//Application::GetSettings().GetStyleSettings().GetFieldTextColor() - DrawLine( pt1, pt2 ); -} - - - - -void SidebarDialControlBmp::DrawBackground() -{ - SetLineColor(); - SetFillColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Paint_PanelBackground)); - DrawRect(maRect); - - const BitmapEx aBitmapEx(SVX_RES(IMG_DIALCONTROL)); - // Size aImageSize(aBitmapEx.GetSizePixel()); - // aImageSize.Width() -= 1; - // aImageSize.Height() -= 1; - SetAntialiasing(ANTIALIASING_ENABLE_B2DDRAW | ANTIALIASING_PIXELSNAPHAIRLINE); - DrawBitmapEx(maRect.TopLeft(), /*aImageSize,*/ aBitmapEx); -} - - -} } // end of namespace svx::sidebar - -// eof diff --git a/svx/source/sidebar/possize/SidebarDialControlBmp.hxx b/svx/source/sidebar/possize/SidebarDialControlBmp.hxx deleted file mode 100644 index d1cb6be9db26..000000000000 --- a/svx/source/sidebar/possize/SidebarDialControlBmp.hxx +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef SVX_SIDEBAR_POSSIZE_DIAL_CONTROL_BMP_HXX -#define SVX_SIDEBAR_POSSIZE_DIAL_CONTROL_BMP_HXX - -#include <svx/dialcontrol.hxx> - -namespace svx { namespace sidebar { - - -class SidebarDialControlBmp - : public svx::DialControlBmp -{ -public: - explicit SidebarDialControlBmp( Window& rParent); - virtual ~SidebarDialControlBmp (void); - - virtual void DrawElements( const String& rText, sal_Int32 nAngle ); - virtual void DrawBackground(); - -private: -}; - -} } // end of namespace svx::sidebar - -#endif - -// eof |