diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-01 14:34:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-02 09:34:07 +0200 |
commit | b4513307785ce0d61b3dcde754b1855f1c65225c (patch) | |
tree | 5ebd5c0acaa0825b83540ea24f9bdd16ada810c1 /sw | |
parent | 34e69d4b9570c11c9ff04711005c7b70faadfff1 (diff) |
annotation label doesn't need to be an Edit, FixedText is enough
similar to:
commit a2d97135411d566b0b1f3d47af7912c8412cee7f
Author: Caolán McNamara <caolanm@redhat.com>
Date: Tue Aug 18 10:23:27 2020 +0100
annotation label doesn't need to be a MultiLine edit, FixedText is enough
Change-Id: I5035ecc2d5d03f7aaeb794006a0cb305bb89a219
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101850
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/AnnotationWin.hxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/docvw/AnnotationWin.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/docvw/AnnotationWin2.cxx | 46 |
3 files changed, 25 insertions, 31 deletions
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx index 715d01ea95ee..1410ad5d689b 100644 --- a/sw/inc/AnnotationWin.hxx +++ b/sw/inc/AnnotationWin.hxx @@ -39,7 +39,7 @@ class Outliner; class ScrollBar; class SwEditWin; class SwView; -class Edit; +class FixedText; class MenuButton; class SwFrame; class SvxLanguageItem; @@ -229,9 +229,9 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window VclPtr<sw::sidebarwindows::SidebarTextControl> mpSidebarTextControl; VclPtr<ScrollBar> mpVScrollbar; - VclPtr<Edit> mpMetadataAuthor; - VclPtr<Edit> mpMetadataDate; - VclPtr<Edit> mpMetadataResolved; + VclPtr<FixedText> mpMetadataAuthor; + VclPtr<FixedText> mpMetadataDate; + VclPtr<FixedText> mpMetadataResolved; VclPtr<MenuButton> mpMenuButton; std::unique_ptr<sw::sidebarwindows::AnchorOverlayObject> mpAnchor; diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index db719948df8b..926085b31e84 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -26,7 +26,7 @@ #include <uiobject.hxx> -#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> #include <vcl/menu.hxx> #include <vcl/scrbar.hxx> #include <vcl/settings.hxx> diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 10493e45a04a..ee19018d04c9 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -51,7 +51,7 @@ #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> -#include <vcl/edit.hxx> +#include <vcl/fixed.hxx> #include <vcl/event.hxx> #include <vcl/scrbar.hxx> #include <vcl/svapp.hxx> @@ -286,7 +286,7 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFl vcl::Font aOrigFont(mpMetadataAuthor->GetControlFont()); Point aPos(PixelToLogic(mpMetadataAuthor->GetPosPixel())); aPos += rPt; - vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetFieldFont() ); + vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetLabelFont() ); mpMetadataAuthor->SetControlFont( aFont ); mpMetadataAuthor->Draw(pDev, aPos, nInFlags); mpMetadataAuthor->SetControlFont( aOrigFont ); @@ -297,7 +297,7 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFl vcl::Font aOrigFont(mpMetadataDate->GetControlFont()); Point aPos(PixelToLogic(mpMetadataDate->GetPosPixel())); aPos += rPt; - vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() ); + vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetLabelFont() ); mpMetadataDate->SetControlFont( aFont ); mpMetadataDate->SetControlFont( aOrigFont ); } @@ -307,7 +307,7 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFl vcl::Font aOrigFont(mpMetadataResolved->GetControlFont()); Point aPos(PixelToLogic(mpMetadataResolved->GetPosPixel())); aPos += rPt; - vcl::Font aFont( mpMetadataResolved->GetSettings().GetStyleSettings().GetFieldFont() ); + vcl::Font aFont( mpMetadataResolved->GetSettings().GetStyleSettings().GetLabelFont() ); mpMetadataResolved->SetControlFont( aFont ); mpMetadataResolved->SetControlFont( aOrigFont ); } @@ -338,7 +338,7 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, DrawFlags nInFl Point aPos(PixelToLogic(mpMenuButton->GetPosPixel())); aPos += rPt; - vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() ); + vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetLabelFont() ); mpMetadataDate->SetControlFont( aFont ); mpMetadataDate->SetControlBackground( Color(0xFFFFFF) ); mpMetadataDate->SetText("..."); @@ -465,11 +465,9 @@ void SwAnnotationWin::InitControls() mpSidebarTextControl->SetPointer(PointerStyle::Text); // window controls for author and date - mpMetadataAuthor = VclPtr<Edit>::Create( this, 0 ); + mpMetadataAuthor = VclPtr<FixedText>::Create(this); mpMetadataAuthor->SetAccessibleName( SwResId( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) ); mpMetadataAuthor->EnableRTL(AllSettings::GetLayoutRTL()); - mpMetadataAuthor->SetReadOnly(); - mpMetadataAuthor->AlwaysDisableInput(true); mpMetadataAuthor->SetCallHandlersOnInputDisabled(true); mpMetadataAuthor->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) ); // we should leave this setting alone, but for this we need a better layout algo @@ -477,18 +475,16 @@ void SwAnnotationWin::InitControls() { AllSettings aSettings = mpMetadataAuthor->GetSettings(); StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - vcl::Font aFont = aStyleSettings.GetFieldFont(); + vcl::Font aFont = aStyleSettings.GetLabelFont(); aFont.SetFontHeight(8); - aStyleSettings.SetFieldFont(aFont); + aStyleSettings.SetLabelFont(aFont); aSettings.SetStyleSettings(aStyleSettings); mpMetadataAuthor->SetSettings(aSettings); } - mpMetadataDate = VclPtr<Edit>::Create( this, 0 ); + mpMetadataDate = VclPtr<FixedText>::Create(this); mpMetadataDate->SetAccessibleName( SwResId( STR_ACCESS_ANNOTATION_DATE_NAME ) ); mpMetadataDate->EnableRTL(AllSettings::GetLayoutRTL()); - mpMetadataDate->SetReadOnly(); - mpMetadataDate->AlwaysDisableInput(true); mpMetadataDate->SetCallHandlersOnInputDisabled(true); mpMetadataDate->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) ); // we should leave this setting alone, but for this we need a better layout algo @@ -496,18 +492,16 @@ void SwAnnotationWin::InitControls() { AllSettings aSettings = mpMetadataDate->GetSettings(); StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - vcl::Font aFont = aStyleSettings.GetFieldFont(); + vcl::Font aFont = aStyleSettings.GetLabelFont(); aFont.SetFontHeight(8); - aStyleSettings.SetFieldFont(aFont); + aStyleSettings.SetLabelFont(aFont); aSettings.SetStyleSettings(aStyleSettings); mpMetadataDate->SetSettings(aSettings); } - mpMetadataResolved = VclPtr<Edit>::Create( this, 0 ); + mpMetadataResolved = VclPtr<FixedText>::Create(this); mpMetadataResolved->SetAccessibleName( SwResId( STR_ACCESS_ANNOTATION_RESOLVED_NAME ) ); mpMetadataResolved->EnableRTL(AllSettings::GetLayoutRTL()); - mpMetadataResolved->SetReadOnly(); - mpMetadataResolved->AlwaysDisableInput(true); mpMetadataResolved->SetCallHandlersOnInputDisabled(true); mpMetadataResolved->AddEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) ); // we should leave this setting alone, but for this we need a better layout algo @@ -515,9 +509,9 @@ void SwAnnotationWin::InitControls() { AllSettings aSettings = mpMetadataResolved->GetSettings(); StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - vcl::Font aFont = aStyleSettings.GetFieldFont(); + vcl::Font aFont = aStyleSettings.GetLabelFont(); aFont.SetFontHeight(8); - aStyleSettings.SetFieldFont(aFont); + aStyleSettings.SetLabelFont(aFont); aSettings.SetStyleSettings(aStyleSettings); mpMetadataResolved->SetSettings(aSettings); mpMetadataResolved->SetText( SwResId( STR_ACCESS_ANNOTATION_RESOLVED_NAME ) ); @@ -641,21 +635,21 @@ void SwAnnotationWin::Rescale() const Fraction& rFraction = mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY(); if ( mpMetadataAuthor ) { - vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetFieldFont() ); + vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetLabelFont() ); sal_Int32 nHeight = long(aFont.GetFontHeight() * rFraction); aFont.SetFontHeight( nHeight ); mpMetadataAuthor->SetControlFont( aFont ); } if ( mpMetadataDate ) { - vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() ); + vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetLabelFont() ); sal_Int32 nHeight = long(aFont.GetFontHeight() * rFraction); aFont.SetFontHeight( nHeight ); mpMetadataDate->SetControlFont( aFont ); } if ( mpMetadataResolved ) { - vcl::Font aFont( mpMetadataResolved->GetSettings().GetStyleSettings().GetFieldFont() ); + vcl::Font aFont( mpMetadataResolved->GetSettings().GetStyleSettings().GetLabelFont() ); sal_Int32 nHeight = long(aFont.GetFontHeight() * rFraction); aFont.SetFontHeight( nHeight ); mpMetadataResolved->SetControlFont( aFont ); @@ -1041,7 +1035,7 @@ void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorA mpMetadataAuthor->SetControlBackground(mColorDark); AllSettings aSettings = mpMetadataAuthor->GetSettings(); StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - aStyleSettings.SetFieldTextColor(aColorAnchor); + aStyleSettings.SetLabelTextColor(aColorAnchor); aSettings.SetStyleSettings(aStyleSettings); mpMetadataAuthor->SetSettings(aSettings); } @@ -1050,7 +1044,7 @@ void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorA mpMetadataDate->SetControlBackground(mColorDark); AllSettings aSettings = mpMetadataDate->GetSettings(); StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - aStyleSettings.SetFieldTextColor(aColorAnchor); + aStyleSettings.SetLabelTextColor(aColorAnchor); aSettings.SetStyleSettings(aStyleSettings); mpMetadataDate->SetSettings(aSettings); } @@ -1059,7 +1053,7 @@ void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorA mpMetadataResolved->SetControlBackground(mColorDark); AllSettings aSettings = mpMetadataResolved->GetSettings(); StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - aStyleSettings.SetFieldTextColor(aColorAnchor); + aStyleSettings.SetLabelTextColor(aColorAnchor); aSettings.SetStyleSettings(aStyleSettings); mpMetadataResolved->SetSettings(aSettings); } |