diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-07-11 08:42:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-11 09:05:13 +0100 |
commit | dd3bb0aa49bbf45138d2ea594fb593729ac3b2b0 (patch) | |
tree | 2f6c92d1e618abae12c5475ff5bdeb2d542b2b98 /sw/source/ui/config | |
parent | b67b78abb57b7d5580dd1e31b86c2c623db528f6 (diff) |
make SwMarkPreview available through .ui format
+ move getting size from ctor to Paint
+ add possibility for border to font preview
+ add possibility for setting initial text via .ui for font preview
+ move old .src combobox contents into .ui and re-enable code
Change-Id: I0470da54c6764d67bccd5828cce9b11d2e7df3b3
Diffstat (limited to 'sw/source/ui/config')
-rw-r--r-- | sw/source/ui/config/optpage.cxx | 80 | ||||
-rw-r--r-- | sw/source/ui/config/redlopt.hrc | 48 | ||||
-rw-r--r-- | sw/source/ui/config/redlopt.src | 234 |
3 files changed, 43 insertions, 319 deletions
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 25e25eda308a..a2a70306f4d2 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -41,7 +41,6 @@ #include <viewopt.hxx> #include <globals.hrc> #include <config.hrc> -#include <redlopt.hrc> #include <optdlg.hrc> #include <swwrtshitem.hxx> #include <unomid.h> @@ -1485,38 +1484,22 @@ static sal_uInt16 aChangedAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 }; /*----------------------------------------------------------------------- Description: Preview of selection -----------------------------------------------------------------------*/ -SwMarkPreview::SwMarkPreview( Window *pParent, const ResId& rResID ) : +SwMarkPreview::SwMarkPreview( Window *pParent, WinBits nWinBits ) : - Window(pParent, rResID), + Window(pParent, nWinBits), m_aTransCol( COL_TRANSPARENT ), m_aMarkCol( COL_LIGHTRED ), nMarkPos(0) { + m_aInitialSize = LogicToPixel(Size(70 , 27), MapMode(MAP_APPFONT)); InitColors(); SetMapMode(MAP_PIXEL); +} - const Size aSz(GetOutputSizePixel()); - - // Page - aPage.SetSize(Size(aSz.Width() - 3, aSz.Height() - 3)); - - sal_uLong nOutWPix = aPage.GetWidth(); - sal_uLong nOutHPix = aPage.GetHeight(); - - // PrintArea - sal_uLong nLBorder = 8; - sal_uLong nRBorder = 8; - sal_uLong nTBorder = 4; - sal_uLong nBBorder = 4; - - aLeftPagePrtArea = Rectangle(Point(nLBorder, nTBorder), Point((nOutWPix - 1) - nRBorder, (nOutHPix - 1) - nBBorder)); - sal_uInt16 nWidth = (sal_uInt16)aLeftPagePrtArea.GetWidth(); - sal_uInt16 nKorr = (nWidth & 1) != 0 ? 0 : 1; - aLeftPagePrtArea.SetSize(Size(nWidth / 2 - (nLBorder + nRBorder) / 2 + nKorr, aLeftPagePrtArea.GetHeight())); - - aRightPagePrtArea = aLeftPagePrtArea; - aRightPagePrtArea.Move(aLeftPagePrtArea.GetWidth() + nLBorder + nRBorder + 1, 0); +extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwMarkPreview(Window *pParent, VclBuilder::stringmap &) +{ + return new SwMarkPreview(pParent, 0); } SwMarkPreview::~SwMarkPreview() @@ -1547,6 +1530,28 @@ void SwMarkPreview::DataChanged( const DataChangedEvent& rDCEvt ) void SwMarkPreview::Paint(const Rectangle &/*rRect*/) { + const Size aSz(GetOutputSizePixel()); + + // Page + aPage.SetSize(Size(aSz.Width() - 3, aSz.Height() - 3)); + + sal_uLong nOutWPix = aPage.GetWidth(); + sal_uLong nOutHPix = aPage.GetHeight(); + + // PrintArea + sal_uLong nLBorder = 8; + sal_uLong nRBorder = 8; + sal_uLong nTBorder = 4; + sal_uLong nBBorder = 4; + + aLeftPagePrtArea = Rectangle(Point(nLBorder, nTBorder), Point((nOutWPix - 1) - nRBorder, (nOutHPix - 1) - nBBorder)); + sal_uInt16 nWidth = (sal_uInt16)aLeftPagePrtArea.GetWidth(); + sal_uInt16 nKorr = (nWidth & 1) != 0 ? 0 : 1; + aLeftPagePrtArea.SetSize(Size(nWidth / 2 - (nLBorder + nRBorder) / 2 + nKorr, aLeftPagePrtArea.GetHeight())); + + aRightPagePrtArea = aLeftPagePrtArea; + aRightPagePrtArea.Move(aLeftPagePrtArea.GetWidth() + nLBorder + nRBorder + 1, 0); + // draw shadow Rectangle aShadow(aPage); aShadow += Point(3, 3); @@ -1636,6 +1641,11 @@ void SwMarkPreview::DrawRect(const Rectangle &rRect, const Color &rFillColor, co Window::DrawRect(rRect); } +Size SwMarkPreview::GetOptimalSize() const +{ + return m_aInitialSize; +} + namespace { void lcl_FillRedlineAttrListBox( @@ -1656,11 +1666,8 @@ namespace SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( Window* pParent, const SfxItemSet& rSet ) : SfxTabPage(pParent, "OptRedLinePage", "modules/swriter/ui/optredlinepage.ui" , rSet) -// ,sAuthor ( SW_RES( STR_AUTHOR )), -// sNone ( SW_RES( STR_NOTHING )) - + , sNone(SW_RESSTR(SW_STR_NONE)) { - get(pInsertLB,"insert"); get(pInsertColorLB,"insertcolor"); get(pInsertedPreviewWN,"insertedpreview"); @@ -1677,21 +1684,21 @@ SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( Window* pParent, get(pMarkColorLB,"markcolor"); get(pMarkPreviewWN,"markpreview"); - //FreeResource(); -/* - for(sal_uInt16 i = 0; i < pInsertLB->GetEntryCount(); i++) + sAuthor = get<Window>("byauthor")->GetText(); + + for (sal_uInt16 i = 0; i < pInsertLB->GetEntryCount(); ++i) { - String sEntry(pInsertLB->GetEntry(i)); + OUString sEntry(pInsertLB->GetEntry(i)); pDeletedLB->InsertEntry(sEntry); pChangedLB->InsertEntry(sEntry); - };*/ -/* + }; + // remove strikethrough from insert and change and underline + double // underline from delete pInsertLB->RemoveEntry(5); pChangedLB->RemoveEntry(5); pDeletedLB->RemoveEntry(4); - pDeletedLB->RemoveEntry(3);*/ + pDeletedLB->RemoveEntry(3); Link aLk = LINK(this, SwRedlineOptionsTabPage, AttribHdl); pInsertLB->SetSelectHdl( aLk ); @@ -1868,7 +1875,6 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet& ) pDeletedColorLB->SetUpdateMode(sal_False); pChangedColorLB->SetUpdateMode(sal_False); pMarkColorLB->SetUpdateMode(sal_False); -/* pInsertColorLB->InsertEntry(sNone); pDeletedColorLB->InsertEntry(sNone); pChangedColorLB->InsertEntry(sNone); @@ -1876,7 +1882,7 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet& ) pInsertColorLB->InsertEntry(sAuthor); pDeletedColorLB->InsertEntry(sAuthor); pChangedColorLB->InsertEntry(sAuthor); -*/ + XColorListRef pColorLst = XColorList::GetStdColorList(); sal_uInt16 i; for( i = 0; i < pColorLst->Count(); ++i ) diff --git a/sw/source/ui/config/redlopt.hrc b/sw/source/ui/config/redlopt.hrc deleted file mode 100644 index 1874f1110c15..000000000000 --- a/sw/source/ui/config/redlopt.hrc +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ -#define FT_INS_ATTR 1 -#define LB_INS_ATTR 2 -#define FT_INS_COL 3 -#define LB_INS_COL 4 -#define WIN_INS 5 -#define FT_DEL_ATTR 6 -#define LB_DEL_ATTR 7 -#define FT_DEL_COL 8 -#define LB_DEL_COL 9 -#define WIN_DEL 10 -#define FT_CHG_ATTR 11 -#define LB_CHG_ATTR 12 -#define FT_CHG_COL 13 -#define LB_CHG_COL 14 -#define WIN_CHG 15 -#define FL_TE 16 - -#define FT_MARKPOS 17 -#define LB_MARKPOS 18 -#define FT_LC_COL 19 -#define LB_LC_COL 20 -#define WIN_MARK 21 -#define FL_LC 22 -#define STR_AUTHOR 23 -#define STR_NOTHING 24 -#define FT_CHG_CHANGE 25 -#define FT_CHG_DELETE 26 -#define FT_CHG_INSERT 27 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/config/redlopt.src b/sw/source/ui/config/redlopt.src deleted file mode 100644 index 5023df5b79dc..000000000000 --- a/sw/source/ui/config/redlopt.src +++ /dev/null @@ -1,234 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 . - */ -/* StarView resource file */ - -#include <sfx2/sfx.hrc> -#include <svx/dialogs.hrc> -#include "globals.hrc" -#include "config.hrc" -#include "redlopt.hrc" -#include "helpid.h" - -TabPage TP_REDLINE_OPT -{ - HelpID = HID_REDLINE_OPT ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ; - FixedLine FL_TE - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Text display" ; - }; - FixedText FT_CHG_INSERT - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Insertions"; - }; - FixedText FT_INS_ATTR - { - Pos = MAP_APPFONT ( 18 , 25 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Attributes"; - }; - ListBox LB_INS_ATTR - { - HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_INS_ATTR"; - Pos = MAP_APPFONT ( 90 , 25 ) ; - Size = MAP_APPFONT ( 80 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "[None]" ; > ; - < "Bold" ; > ; - < "Italic" ; > ; - < "Underlined" ; > ; - < "Underlined: double" ; > ; - < "Strikethrough" ; > ; - < "Uppercase" ; > ; - < "Lowercase" ; > ; - < "Small caps" ; > ; - < "Title font" ; > ; - < "Background color" ; > ; - }; - }; - FixedText FT_INS_COL - { - Pos = MAP_APPFONT ( 18 , 42 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Color" ; - }; - ListBox LB_INS_COL - { - HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_INS_COL"; - Pos = MAP_APPFONT ( 90 , 40 ) ; - Size = MAP_APPFONT ( 80 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - Window WIN_INS - { - Border = TRUE ; - Pos = MAP_APPFONT ( 178 , 25 ) ; - Size = MAP_APPFONT ( 70 , 27 ) ; - Text [ en-US ] = "Insert"; - }; - FixedText FT_CHG_DELETE - { - Pos = MAP_APPFONT ( 12 , 58 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Deletions"; - }; - FixedText FT_DEL_ATTR - { - Pos = MAP_APPFONT ( 18 , 69 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Attributes"; - }; - ListBox LB_DEL_ATTR - { - HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_DEL_ATTR"; - Pos = MAP_APPFONT ( 90 , 67 ) ; - Size = MAP_APPFONT ( 80 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_DEL_COL - { - Pos = MAP_APPFONT ( 18 , 84 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Color"; - }; - ListBox LB_DEL_COL - { - HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_DEL_COL"; - Pos = MAP_APPFONT ( 90 , 82 ) ; - Size = MAP_APPFONT ( 80 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - Window WIN_DEL - { - Border = TRUE ; - Pos = MAP_APPFONT ( 178 , 67 ) ; - Size = MAP_APPFONT ( 70 , 27 ) ; - Text [ en-US ] = "Delete"; - }; - FixedText FT_CHG_CHANGE - { - Pos = MAP_APPFONT ( 12 , 100 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Changed attributes"; - }; - FixedText FT_CHG_ATTR - { - Pos = MAP_APPFONT ( 18 , 113 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Attributes"; - }; - ListBox LB_CHG_ATTR - { - HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_CHG_ATTR"; - Pos = MAP_APPFONT ( 90 , 111 ) ; - Size = MAP_APPFONT ( 80 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - FixedText FT_CHG_COL - { - Pos = MAP_APPFONT ( 18 , 128 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Color"; - }; - ListBox LB_CHG_COL - { - HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_CHG_COL"; - Pos = MAP_APPFONT ( 90 , 126 ) ; - Size = MAP_APPFONT ( 80 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - Window WIN_CHG - { - Border = TRUE ; - Pos = MAP_APPFONT ( 178 , 111 ) ; - Size = MAP_APPFONT ( 70 , 27 ) ; - Text [ en-US ] = "Attributes"; - }; - FixedLine FL_LC - { - Pos = MAP_APPFONT ( 6 , 144 ) ; - Size = MAP_APPFONT ( 248 , 8 ) ; - Text [ en-US ] = "Lines changed" ; - }; - FixedText FT_MARKPOS - { - Pos = MAP_APPFONT ( 12 , 157 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "Mar~k" ; - }; - ListBox LB_MARKPOS - { - HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_MARKPOS"; - Pos = MAP_APPFONT ( 90 , 155 ) ; - Size = MAP_APPFONT ( 80 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList [ en-US ] = - { - < "[None]" ; > ; - < "Left margin" ; > ; - < "Right margin" ; > ; - < "Outer margin" ; > ; - < "Inner margin" ; > ; - }; - }; - FixedText FT_LC_COL - { - Pos = MAP_APPFONT ( 12 , 172 ) ; - Size = MAP_APPFONT ( 70 , 8 ) ; - Text [ en-US ] = "~Color" ; - }; - ListBox LB_LC_COL - { - HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_LC_COL"; - Pos = MAP_APPFONT ( 90 , 170 ) ; - Size = MAP_APPFONT ( 80 , 80 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - }; - Window WIN_MARK - { - Pos = MAP_APPFONT ( 178 , 155 ) ; - Size = MAP_APPFONT ( 70 , 27 ) ; - }; - String STR_AUTHOR - { - Text [ en-US ] = "By author" ; - }; - String STR_NOTHING - { - Text [ en-US ] = "[None]" ; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |