summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/AnnotationWin.hxx2
-rw-r--r--sw/inc/strings.hrc1
-rw-r--r--sw/source/uibase/docvw/AnnotationWin.cxx11
-rw-r--r--sw/source/uibase/docvw/AnnotationWin2.cxx64
4 files changed, 72 insertions, 6 deletions
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 196aa1d6dc18..2af2d9e56b37 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -157,6 +157,7 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window
sal_Int32 GetMinimumSizeWithoutMeta();
sal_Int32 GetMetaButtonAreaWidth();
sal_Int32 GetScrollbarWidth();
+ sal_Int32 GetNumFields();
void SetSpellChecking();
@@ -230,6 +231,7 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window
VclPtr<ScrollBar> mpVScrollbar;
VclPtr<Edit> mpMetadataAuthor;
VclPtr<Edit> mpMetadataDate;
+ VclPtr<Edit> mpMetadataResolved;
VclPtr<MenuButton> mpMenuButton;
std::unique_ptr<sw::sidebarwindows::AnchorOverlayObject> mpAnchor;
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 33778069c4fa..59bab4121472 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -565,6 +565,7 @@
#define STR_ACCESS_PAGE_DESC NC_("STR_ACCESS_PAGE_DESC", "Page: $(ARG1)")
#define STR_ACCESS_ANNOTATION_AUTHOR_NAME NC_("STR_ACCESS_ANNOTATION_AUTHOR_NAME", "Author")
#define STR_ACCESS_ANNOTATION_DATE_NAME NC_("STR_ACCESS_ANNOTATION_DATE_NAME", "Date")
+#define STR_ACCESS_ANNOTATION_RESOLVED_NAME NC_("STR_ACCESS_ANNOTATION_RESOLVED_NAME", "Resolved")
#define STR_ACCESS_ANNOTATION_BUTTON_NAME NC_("STR_ACCESS_ANNOTATION_BUTTON_NAME", "Actions")
#define STR_ACCESS_ANNOTATION_BUTTON_DESC NC_("STR_ACCESS_ANNOTATION_BUTTON_DESC", "Activate this button to open a list of actions which can be performed on this comment and other comments")
#define STR_ACCESS_PREVIEW_DOC_NAME NC_("STR_ACCESS_PREVIEW_DOC_NAME", "Document preview")
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index b270c06ec65a..34854f4d421b 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -152,6 +152,12 @@ void SwAnnotationWin::dispose()
}
mpMetadataAuthor.disposeAndClear();
+ if (mpMetadataResolved)
+ {
+ mpMetadataResolved->RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
+ }
+ mpMetadataResolved.disposeAndClear();
+
if (mpMetadataDate)
{
mpMetadataDate->RemoveEventListener( LINK( this, SwAnnotationWin, WindowEventListener ) );
@@ -221,6 +227,11 @@ void SwAnnotationWin::SetResolved(bool resolved)
static_cast<SwPostItField*>(mpFormatField->GetField())->SetResolved(resolved);
mrSidebarItem.bShow = !IsResolved();
+ if(IsResolved())
+ mpMetadataResolved->Show();
+ else
+ mpMetadataResolved->Hide();
+
mbResolvedStateUpdated = true;
UpdateData();
Invalidate();
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 232bfd80c124..33edbdfacc81 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -158,7 +158,7 @@ namespace sw { namespace annotation {
#define METABUTTON_WIDTH 16
#define METABUTTON_HEIGHT 18
#define METABUTTON_AREA_WIDTH 30
-#define POSTIT_META_HEIGHT sal_Int32(30)
+#define POSTIT_META_FIELD_HEIGHT sal_Int32(15)
#define POSTIT_MINIMUMSIZE_WITHOUT_META 50
@@ -178,11 +178,13 @@ void SwAnnotationWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rec
rRenderContext.SetFillColor(mColorDark);
}
+ sal_uInt32 boxHeight = mpMetadataAuthor->GetSizePixel().Height() + mpMetadataDate->GetSizePixel().Height();
+ boxHeight += IsThreadResolved() ? mpMetadataResolved->GetSizePixel().Height() : 0;
+
rRenderContext.SetLineColor();
tools::Rectangle aRectangle(Point(mpMetadataAuthor->GetPosPixel().X() + mpMetadataAuthor->GetSizePixel().Width(),
mpMetadataAuthor->GetPosPixel().Y()),
- Size(GetMetaButtonAreaWidth(),
- mpMetadataAuthor->GetSizePixel().Height() + mpMetadataDate->GetSizePixel().Height()));
+ Size(GetMetaButtonAreaWidth(), boxHeight));
if (comphelper::LibreOfficeKit::isActive())
aRectangle = rRect;
@@ -490,6 +492,26 @@ void SwAnnotationWin::InitControls()
mpMetadataDate->SetSettings(aSettings);
}
+ mpMetadataResolved = VclPtr<Edit>::Create( this, 0 );
+ 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
+ // with variable meta size height
+ {
+ AllSettings aSettings = mpMetadataResolved->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ vcl::Font aFont = aStyleSettings.GetFieldFont();
+ aFont.SetFontHeight(8);
+ aStyleSettings.SetFieldFont(aFont);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataResolved->SetSettings(aSettings);
+ mpMetadataResolved->SetText( SwResId( STR_ACCESS_ANNOTATION_RESOLVED_NAME ) );
+ }
+
SwDocShell* aShell = mrView.GetDocShell();
mpOutliner.reset(new Outliner(&aShell->GetPool(),OutlinerMode::TextObject));
aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner.get() );
@@ -549,6 +571,7 @@ void SwAnnotationWin::InitControls()
mpSidebarTextControl->Show();
mpMetadataAuthor->Show();
mpMetadataDate->Show();
+ if(IsThreadResolved()) { mpMetadataResolved->Show(); }
mpVScrollbar->Show();
}
@@ -611,6 +634,13 @@ void SwAnnotationWin::Rescale()
aFont.SetFontHeight( nHeight );
mpMetadataDate->SetControlFont( aFont );
}
+ if ( mpMetadataResolved )
+ {
+ vcl::Font aFont( mpMetadataResolved->GetSettings().GetStyleSettings().GetFieldFont() );
+ sal_Int32 nHeight = long(aFont.GetFontHeight() * rFraction);
+ aFont.SetFontHeight( nHeight );
+ mpMetadataResolved->SetControlFont( aFont );
+ }
}
void SwAnnotationWin::SetPosAndSize()
@@ -855,9 +885,10 @@ void SwAnnotationWin::DoResize()
aHeight -= GetMetaHeight();
mpMetadataAuthor->Show();
+ if(IsThreadResolved()) { mpMetadataResolved->Show(); }
mpMetadataDate->Show();
mpSidebarTextControl->SetQuickHelpText(OUString());
-
+ unsigned int numFields = GetNumFields();
if (aTextHeight > aHeight)
{ // we need vertical scrollbars and have to reduce the width
aWidth -= GetScrollbarWidth();
@@ -870,7 +901,7 @@ void SwAnnotationWin::DoResize()
{
const Size aSizeOfMetadataControls( GetSizePixel().Width() - GetMetaButtonAreaWidth(),
- GetMetaHeight()/2 );
+ GetMetaHeight()/numFields );
mpMetadataAuthor->setPosSizePixel( 0,
aHeight,
aSizeOfMetadataControls.Width(),
@@ -879,6 +910,12 @@ void SwAnnotationWin::DoResize()
aHeight + aSizeOfMetadataControls.Height(),
aSizeOfMetadataControls.Width(),
aSizeOfMetadataControls.Height() );
+ if(IsThreadResolved()) {
+ mpMetadataResolved->setPosSizePixel( 0,
+ aHeight + aSizeOfMetadataControls.Height()*2,
+ aSizeOfMetadataControls.Width(),
+ aSizeOfMetadataControls.Height() );
+ }
}
mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
@@ -998,6 +1035,15 @@ void SwAnnotationWin::SetColor(Color aColorDark,Color aColorLight, Color aColorA
mpMetadataDate->SetSettings(aSettings);
}
+ {
+ mpMetadataResolved->SetControlBackground(mColorDark);
+ AllSettings aSettings = mpMetadataResolved->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetFieldTextColor(aColorAnchor);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataResolved->SetSettings(aSettings);
+ }
+
AllSettings aSettings2 = mpVScrollbar->GetSettings();
StyleSettings aStyleSettings2 = aSettings2.GetStyleSettings();
aStyleSettings2.SetButtonTextColor(Color(0,0,0));
@@ -1314,7 +1360,13 @@ sal_Int32 SwAnnotationWin::GetMetaButtonAreaWidth()
sal_Int32 SwAnnotationWin::GetMetaHeight()
{
const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
- return long(POSTIT_META_HEIGHT * f);
+ const int fields = GetNumFields();
+ return long(fields*POSTIT_META_FIELD_HEIGHT*f);
+}
+
+sal_Int32 SwAnnotationWin::GetNumFields()
+{
+ return IsThreadResolved() ? 3 : 2;
}
sal_Int32 SwAnnotationWin::GetMinimumSizeWithMeta()