[Libreoffice-commits] .: 195 commits - drawinglayer/inc drawinglayer/Library_drawinglayer.mk drawinglayer/Package_inc.mk drawinglayer/source framework/uiconfig icon-themes/galaxy officecfg/registry sc/source sd/uiconfig sfx2/AllLangResTarget_sfx2.mk sfx2/inc sfx2/Library_sfx.mk sfx2/Package_inc.mk sfx2/sdi sfx2/source svtools/Library_svt.mk svtools/Package_inc.mk svx/inc svx/Library_svxcore.mk svx/Package_inc.mk svx/source sw/source sw/uiconfig

Rafael Dominguez rdominguez at kemper.freedesktop.org
Fri Jul 6 02:53:06 PDT 2012


 drawinglayer/Library_drawinglayer.mk                                    |    4 
 drawinglayer/Package_inc.mk                                             |    1 
 drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx          |    6 
 drawinglayer/inc/drawinglayer/processor2d/processorfromoutputdevice.hxx |   66 
 drawinglayer/source/primitive2d/mediaprimitive2d.cxx                    |   14 
 drawinglayer/source/processor2d/processorfromoutputdevice.cxx           |   96 
 framework/uiconfig/startmodule/menubar/menubar.xml                      |    1 
 icon-themes/galaxy/sfx2/res/create_draw.png                             |binary
 icon-themes/galaxy/sfx2/res/create_present.png                          |binary
 icon-themes/galaxy/sfx2/res/create_sheet.png                            |binary
 icon-themes/galaxy/sfx2/res/create_text.png                             |binary
 icon-themes/galaxy/sfx2/res/exec_action.png                             |binary
 icon-themes/galaxy/sfx2/res/import.png                                  |binary
 icon-themes/galaxy/sfx2/res/search.png                                  |binary
 icon-themes/galaxy/sfx2/res/select.png                                  |binary
 icon-themes/galaxy/sfx2/res/sortascending.png                           |binary
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu    |    5 
 sc/source/ui/view/output.cxx                                            |    4 
 sd/uiconfig/sdraw/menubar/menubar.xml                                   |    1 
 sd/uiconfig/simpress/menubar/menubar.xml                                |    1 
 sfx2/AllLangResTarget_sfx2.mk                                           |   13 
 sfx2/Library_sfx.mk                                                     |   14 
 sfx2/Package_inc.mk                                                     |    7 
 sfx2/inc/sfx2/sfxcommands.h                                             |    7 
 sfx2/inc/sfx2/sfxsids.hrc                                               |    2 
 sfx2/inc/sfx2/templatefolderview.hxx                                    |   93 
 sfx2/inc/sfx2/templatefolderviewitem.hxx                                |   39 
 sfx2/inc/sfx2/templateproperties.hxx                                    |   15 
 sfx2/inc/sfx2/templateview.hxx                                          |   71 
 sfx2/inc/sfx2/templateviewitem.hxx                                      |   49 
 sfx2/inc/sfx2/thumbnailview.hxx                                         |  360 +++
 sfx2/inc/sfx2/thumbnailviewitem.hxx                                     |  126 +
 sfx2/inc/templatedlg.hxx                                                |  103 
 sfx2/sdi/appslots.sdi                                                   |    5 
 sfx2/sdi/sfx.sdi                                                        |   24 
 sfx2/source/appl/appserv.cxx                                            |   21 
 sfx2/source/control/templatefolderview.cxx                              |  707 ++++++
 sfx2/source/control/templatefolderviewitem.cxx                          |  117 +
 sfx2/source/control/templatesearchview.cxx                              |   56 
 sfx2/source/control/templateview.cxx                                    |  231 +
 sfx2/source/control/templateview.hrc                                    |    9 
 sfx2/source/control/templateview.src                                    |   17 
 sfx2/source/control/templateviewitem.cxx                                |   23 
 sfx2/source/control/thumbnailview.cxx                                   | 1157 ++++++++++
 sfx2/source/control/thumbnailviewacc.cxx                                | 1009 ++++++++
 sfx2/source/control/thumbnailviewacc.hxx                                |  245 ++
 sfx2/source/control/thumbnailviewitem.cxx                               |  224 +
 sfx2/source/dialog/inputdlg.cxx                                         |   84 
 sfx2/source/dialog/inputdlg.hrc                                         |   13 
 sfx2/source/dialog/inputdlg.src                                         |   48 
 sfx2/source/doc/doc.hrc                                                 |    1 
 sfx2/source/doc/templatedlg.cxx                                         |  790 ++++++
 sfx2/source/doc/templatedlg.hrc                                         |   61 
 sfx2/source/doc/templatedlg.src                                         |  280 ++
 sfx2/source/inc/inputdlg.hxx                                            |   43 
 sfx2/source/inc/templatesearchview.hxx                                  |   30 
 svtools/Library_svt.mk                                                  |    4 
 svtools/Package_inc.mk                                                  |    2 
 svx/Library_svxcore.mk                                                  |    1 
 svx/Package_inc.mk                                                      |    1 
 svx/inc/svx/sdr/contact/objectcontacttools.hxx                          |   66 
 svx/source/sdr/contact/objectcontactofobjlistpainter.cxx                |    7 
 svx/source/sdr/contact/objectcontactofpageview.cxx                      |    7 
 svx/source/sdr/contact/objectcontacttools.cxx                           |   96 
 svx/source/sdr/contact/viewcontactofsdrmediaobj.cxx                     |    4 
 svx/source/sdr/overlay/overlaymanager.cxx                               |    9 
 svx/source/sdr/overlay/overlayobject.cxx                                |    1 
 svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx             |    2 
 sw/source/core/layout/paintfrm.cxx                                      |    4 
 sw/source/ui/docvw/DashedLine.cxx                                       |    4 
 sw/source/ui/docvw/HeaderFooterWin.cxx                                  |    4 
 sw/source/ui/docvw/PageBreakWin.cxx                                     |    4 
 sw/uiconfig/sglobal/menubar/menubar.xml                                 |    1 
 sw/uiconfig/sweb/menubar/menubar.xml                                    |    1 
 sw/uiconfig/swform/menubar/menubar.xml                                  |    1 
 sw/uiconfig/swreport/menubar/menubar.xml                                |    1 
 sw/uiconfig/swriter/menubar/menubar.xml                                 |    1 
 sw/uiconfig/swxform/menubar/menubar.xml                                 |    1 
 78 files changed, 6307 insertions(+), 208 deletions(-)

New commits:
commit 5eb74b1fcad83c605cc00e377460e0ae313d7277
Merge: dafa1f5... fa99c1e...
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Fri Jul 6 05:23:43 2012 -0430

    Merge branch 'feature/template-dialog'
    
    Conflicts:
    	sfx2/Library_sfx.mk
    	sfx2/inc/sfx2/sfxcommands.h
    	sfx2/inc/sfx2/sfxsids.hrc
    	sfx2/source/appl/appserv.cxx
    	svtools/Library_svt.mk
    
    Change-Id: I4305d81cb5fd6f5192a29f85835c78f31310b0d6

diff --cc drawinglayer/Library_drawinglayer.mk
index cfbf6b0,54f6df8..94ab023
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@@ -34,13 -34,15 +34,12 @@@ $(eval $(call gb_Library_set_include,dr
  ))
  
  $(eval $(call gb_Library_add_defs,drawinglayer,\
- 	-DDRAWINGLAYER_DLLIMPLEMENTATION \
+     -DDRAWINGLAYER_DLLIMPLEMENTATION \
  ))
  
 -$(eval $(call gb_Library_use_api,drawinglayer,\
 -    offapi \
 -    udkapi \
 -))
 +$(eval $(call gb_Library_use_sdk_api,drawinglayer))
  
  $(eval $(call gb_Library_use_libraries,drawinglayer,\
-     avmedia \
      basegfx \
      canvastools \
      comphelper \
diff --cc drawinglayer/source/processor2d/processorfromoutputdevice.cxx
index 0000000,dcbaf25..58f2690
mode 000000,100644..100644
--- a/drawinglayer/source/processor2d/processorfromoutputdevice.cxx
+++ b/drawinglayer/source/processor2d/processorfromoutputdevice.cxx
@@@ -1,0 -1,105 +1,96 @@@
+ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 -/*************************************************************************
 - *
 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 - *
 - * Copyright 2000, 2010 Oracle and/or its affiliates.
 - *
 - * OpenOffice.org - a multi-platform office productivity suite
 - *
 - * This file is part of OpenOffice.org.
 - *
 - * OpenOffice.org is free software: you can redistribute it and/or modify
 - * it under the terms of the GNU Lesser General Public License version 3
 - * only, as published by the Free Software Foundation.
 - *
 - * OpenOffice.org is distributed in the hope that it will be useful,
 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 - * GNU Lesser General Public License version 3 for more details
 - * (a copy is included in the LICENSE file that accompanied this code).
 - *
 - * You should have received a copy of the GNU Lesser General Public License
 - * version 3 along with OpenOffice.org.  If not, see
 - * <http://www.openoffice.org/license.html>
 - * for a copy of the LGPLv3 License.
 - *
 - ************************************************************************/
++/*
++ * 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 <vcl/outdev.hxx>
+ #include <basegfx/matrix/b2dhommatrix.hxx>
+ #include <basegfx/range/b2drange.hxx>
+ #include <vcl/gdimtf.hxx>
+ #include <basegfx/tools/canvastools.hxx>
+ #include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
+ #include <drawinglayer/processor2d/vclmetafileprocessor2d.hxx>
+ #include <drawinglayer/processor2d/vclpixelprocessor2d.hxx>
+ #include <drawinglayer/processor2d/canvasprocessor.hxx>
+ #include <vcl/window.hxx>
+ 
+ //////////////////////////////////////////////////////////////////////////////
+ 
+ using namespace com::sun::star;
+ 
+ //////////////////////////////////////////////////////////////////////////////
+ 
+ namespace drawinglayer
+ {
+     namespace processor2d
+     {
+         drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice(
+             OutputDevice& rTargetOutDev,
+             const drawinglayer::geometry::ViewInformation2D& rViewInformation2D)
+         {
+             const GDIMetaFile* pMetaFile = rTargetOutDev.GetConnectMetaFile();
+             const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
+ 
+             if(bOutputToRecordingMetaFile)
+             {
+                 // create MetaFile Vcl-Processor and process
+                 return new drawinglayer::processor2d::VclMetafileProcessor2D(rViewInformation2D, rTargetOutDev);
+             }
+             else
+             {
+ #ifdef WIN32
+                 // for a first AA incarnation VCL-PixelRenderer will be okay since
+                 // simple (and fast) GDIPlus support over VCL will be used.
+                 // Leaving the code below as a hint for what to do when we will
+                 // use canvas renderers in the future
+ 
+                 //static SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ 
+                 //if(false && aSvtOptionsDrawinglayer.IsAntiAliasing())
+                 //{
+                 //  // for WIN32 AA, create cairo canvas processor
+                 //  return new drawinglayer::processor2d::canvasProcessor2D(rViewInformation2D, rTargetOutDev);
+                 //}
+                 //else
+                 //{
+                     // create Pixel Vcl-Processor
+                     return new drawinglayer::processor2d::VclPixelProcessor2D(rViewInformation2D, rTargetOutDev);
+                 //}
+ #else
+                 static bool bTryTestCanvas(false);
+ 
+                 if(bTryTestCanvas)
+                 {
+                     // create test-cancas-Processor
+                     return new drawinglayer::processor2d::canvasProcessor2D(rViewInformation2D, rTargetOutDev);
+                 }
+                 else
+                 {
+                     // create Pixel Vcl-Processor
+                     return new drawinglayer::processor2d::VclPixelProcessor2D(rViewInformation2D, rTargetOutDev);
+                 }
+ #endif
+             }
+         }
+     } // end of namespace processor2d
+ } // end of namespace drawinglayer
+ 
+ //////////////////////////////////////////////////////////////////////////////
+ // eof
+ 
+ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --cc framework/uiconfig/startmodule/menubar/menubar.xml
index 0a6c5cf,d73d9aa..bf9e4d2
mode 100644,100755..100644
--- a/framework/uiconfig/startmodule/menubar/menubar.xml
+++ b/framework/uiconfig/startmodule/menubar/menubar.xml
diff --cc sd/uiconfig/sdraw/menubar/menubar.xml
index a6cbd33,510835d..5fbfaac
mode 100644,100755..100644
--- a/sd/uiconfig/sdraw/menubar/menubar.xml
+++ b/sd/uiconfig/sdraw/menubar/menubar.xml
diff --cc sd/uiconfig/simpress/menubar/menubar.xml
index 6d5e362,f145d49..ba55344
mode 100644,100755..100644
--- a/sd/uiconfig/simpress/menubar/menubar.xml
+++ b/sd/uiconfig/simpress/menubar/menubar.xml
diff --cc sfx2/Library_sfx.mk
index 562d3c2,1b2944b..709cdee
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@@ -211,7 -225,7 +222,8 @@@ $(eval $(call gb_Library_add_exception_
      sfx2/source/doc/sfxbasemodel \
      sfx2/source/doc/sfxmodelfactory \
      sfx2/source/doc/syspath \
 +    sfx2/source/doc/zoomitem \
+     sfx2/source/doc/templatedlg \
      sfx2/source/explorer/nochaos \
      sfx2/source/inet/inettbc \
      sfx2/source/menu/mnuitem \
diff --cc sfx2/inc/sfx2/sfxcommands.h
index 18ebb59,3cd7d85..451e0ba
--- a/sfx2/inc/sfx2/sfxcommands.h
+++ b/sfx2/inc/sfx2/sfxcommands.h
@@@ -28,29 -28,178 +28,36 @@@
  #ifndef SFX2_SFXCOMMANDS_HRC
  #define SFX2_SFXCOMMANDS_HRC
  
 -#define CMD_SID_VIEWSHELL0                          ".uno:_SwitchViewShell0"
 -#define CMD_SID_VIEWSHELL1                          ".uno:_SwitchViewShell1"
 -#define CMD_SID_VIEWSHELL2                          ".uno:_SwitchViewShell2"
 -#define CMD_SID_VIEWSHELL3                          ".uno:_SwitchViewShell3"
 -#define CMD_SID_VIEWSHELL4                          ".uno:_SwitchViewShell4"
  #define CMD_SID_ABOUT                               ".uno:About"
 -#define CMD_SID_ACTIVATE                            ".uno:Activate"
 -#define CMD_SID_HELPBALLOONS                        ".uno:ActiveHelp"
 -#define CMD_SID_STYLE_FAMILY                        ".uno:ActualStyleFamily"
  #define CMD_SID_NEWDOC                              ".uno:NewDoc"
 -#define CMD_SID_CREATELINK                          ".uno:AddBookmark"
 -#define CMD_SID_NEWDOCDIRECT                        ".uno:AddDirect"
 -#define CMD_SID_TEMPLATE_ADDRESSBOKSOURCE           ".uno:AddressBookSource"
 -#define CMD_SID_BASICIDE_ADDWATCH                   ".uno:AddWatch"
 -#define CMD_SID_DOCINFO_AUTHOR                      ".uno:Author"
 -#define CMD_SID_AUTOHIDE                            ".uno:AutoHide"
 -#define CMD_SID_AUTOPILOTMENU                       ".uno:AutoPilotMenu"
 -#define CMD_SID_GALLERY_BG_BRUSH                    ".uno:BackgroundImage"
 -#define CMD_SID_BACKSPACE                           ".uno:Backspace"
 -#define CMD_SID_BASICBREAK                          ".uno:BasicBreak"
 -#define CMD_SID_BASICIDE_APPEAR                     ".uno:BasicIDEAppear"
 -#define CMD_SID_BASICSTEPINTO                       ".uno:BasicStepInto"
 -#define CMD_SID_BASICSTEPOUT                        ".uno:BasicStepOut"
 -#define CMD_SID_BASICSTEPOVER                       ".uno:BasicStepOver"
 -#define CMD_SID_BASICSTOP                           ".uno:BasicStop"
 -#define CMD_SID_BROWSER                             ".uno:Beamer"
 -#define CMD_SID_BASICIDE_BRKPNTSCHANGED             ".uno:BreakPointsChanged"
  #define CMD_SID_BROWSE_BACKWARD                     ".uno:BrowseBackward"
  #define CMD_SID_BROWSE_FORWARD                      ".uno:BrowseForward"
 -#define CMD_SID_BROWSER_MODE                        ".uno:BrowseView"
 -#define CMD_SID_BUILD_VERSION                       ".uno:BuildVersion"
 -#define CMD_SID_CAPTION                             ".uno:Caption"
 -#define CMD_SID_STYLE_FAMILY1                       ".uno:CharStyle"
 -#define CMD_SID_CHECK_KEY                           ".uno:CheckKey"
 -#define CMD_SID_BASICIDE_CHOOSEMACRO                ".uno:ChooseMacro"
 -#define CMD_SID_CLEARHISTORY                        ".uno:ClearHistory"
 -#define CMD_SID_CLOSEWINS                           ".uno:CloseWins"
 -#define CMD_SID_CLOSEDOCS                           ".uno:CloseDocs"
 -#define CMD_SID_CLOSEDOC                            ".uno:CloseDoc"
  #define CMD_SID_CLOSEWIN                            ".uno:CloseWin"
 -#define CMD_SID_CLOSING                             ".uno:Closing"
 -#define CMD_SID_DOCINFO_COMMENTS                    ".uno:Comments"
 -#define CMD_SID_OFFICE_COMMERCIAL_USE               ".uno:CommercialUse"
 -#define CMD_SID_DOCUMENT_COMPARE                    ".uno:CompareDocuments"
 -#define CMD_SID_BASICCOMPILE                        ".uno:CompileBasic"
 -#define CMD_SID_CONFIG                              ".uno:ConfigureDialog"
 -#define CMD_SID_CONTEXT                             ".uno:Context"
  #define CMD_SID_COPY                                ".uno:Copy"
 -#define CMD_SID_CRASH                               ".uno:Crash"
 -#define CMD_SID_BASICIDE_CREATEMACRO                ".uno:CreateMacro"
 -#define CMD_SID_CURRENT_URL                         ".uno:CurrentURL"
 -#define CMD_SID_CURSORENDOFSCREEN                   ".uno:CursorEndOfScreen"
 -#define CMD_SID_CURSORTOPOFSCREEN                   ".uno:CursorTopOfScreen"
 -#define CMD_SID_OFFICE_CUSTOMERNUMBER               ".uno:CustomerNumber"
  #define CMD_SID_CUT                                 ".uno:Cut"
 -#define CMD_SID_DEFAULTFILEPATH                     ".uno:DefaultFilePath"
 -#define CMD_SID_DEFAULTFILENAME                     ".uno:DefaultFileName"
  #define CMD_SID_DELETE                              ".uno:Delete"
  #define CMD_SID_BASICIDE_DELETECURRENT              ".uno:DeleteCurrent"
 -#define CMD_SID_STYLE_DELETE                        ".uno:DeleteStyle"
  #define CMD_SID_STYLE_DESIGNER                      ".uno:DesignerDialog"
 -#define CMD_SID_STYLE_DRAGHIERARCHIE                ".uno:DragHierarchy"
  #define CMD_SID_EDITDOC                             ".uno:EditDoc"
 -#define CMD_SID_BASICIDE_EDITMACRO                  ".uno:EditMacro"
  #define CMD_SID_STYLE_EDIT                          ".uno:EditStyle"
 -#define CMD_FID_SEARCH_NOW                          ".uno:ExecuteSearch"
 -#define CMD_SID_EXTENDEDHELP                        ".uno:ExtendedHelp"
 -#define CMD_SID_FILE_NAME                           ".uno:FileName"
 -#define CMD_SID_FOCUSURLBOX                         ".uno:FocusUrlBox"
 -#define CMD_SID_FORMATMENU                          ".uno:FormatMenu"
 -#define CMD_SID_STYLE_FAMILY3                       ".uno:FrameStyle"
 -#define CMD_SID_PROGFILENAME                        ".uno:FullName"
 -#define CMD_SID_DOCFULLNAME                         ".uno:FullName"
  #define CMD_SID_WIN_FULLSCREEN                      ".uno:FullScreen"
 -#define CMD_SID_FILLFRAME                           ".uno:GetFrameWindow"
 -#define CMD_SID_CURSORDOWN                          ".uno:GoDown"
 -#define CMD_SID_CURSORPAGEDOWN                      ".uno:GoDownBlock"
 -#define CMD_SID_CURSORPAGEDOWN_SEL                  ".uno:GoDownBlockSel"
 -#define CMD_SID_CURSORDOWN_SEL                      ".uno:GoDownSel"
 -#define CMD_SID_CURSORLEFT                          ".uno:GoLeft"
 -#define CMD_SID_CURSORPAGELEFT                      ".uno:GoLeftBlock"
 -#define CMD_SID_CURSORPAGELEFT_SEL                  ".uno:GoLeftBlockSel"
 -#define CMD_SID_CURSORLEFT_SEL                      ".uno:GoLeftSel"
 -#define CMD_SID_CURSORRIGHT                         ".uno:GoRight"
 -#define CMD_SID_CURSORRIGHT_SEL                     ".uno:GoRightSel"
 -#define CMD_SID_CURSORENDOFFILE                     ".uno:GoToEndOfData"
 -#define CMD_SID_CURSORENDOFFILE_SEL                 ".uno:GoToEndOfDataSel"
 -#define CMD_SID_CURSOREND                           ".uno:GoToEndOfRow"
 -#define CMD_SID_CURSOREND_SEL                       ".uno:GoToEndOfRowSel"
 -#define CMD_SID_CURSORTOPOFFILE                     ".uno:GoToStart"
 -#define CMD_SID_CURSORHOME                          ".uno:GoToStartOfRow"
 -#define CMD_SID_CURSORHOME_SEL                      ".uno:GoToStartOfRowSel"
 -#define CMD_SID_CURSORTOPOFFILE_SEL                 ".uno:GoToStartSel"
 -#define CMD_SID_CURSORUP                            ".uno:GoUp"
 -#define CMD_SID_CURSORPAGEUP                        ".uno:GoUpBlock"
 -#define CMD_SID_CURSORPAGEUP_SEL                    ".uno:GoUpBlockSel"
 -#define CMD_SID_CURSORUP_SEL                        ".uno:GoUpSel"
 -#define CMD_SID_HELP_ANNOTATE                       ".uno:HelpAnnotate"
 -#define CMD_SID_HELP_BOOKMARK                       ".uno:HelpBookmark"
 -#define CMD_SID_HELP_HELPFILEBOX                    ".uno:HelpChooseFile"
 -#define CMD_SID_HELP_DOWNLOAD                       ".uno:HelpDownload"
 -#define CMD_SID_HELP_PI                             ".uno:HelperDialog"
 -#define CMD_SID_HELPINDEX                           ".uno:HelpIndex"
 -#define CMD_SID_HELPMENU                            ".uno:HelpMenu"
 -#define CMD_SID_HELPONHELP                          ".uno:HelpOnHelp"
 -#define CMD_SID_HELP_SEARCH                         ".uno:HelpSearch"
 -#define CMD_SID_HELPTIPS                            ".uno:HelpTip"
 -#define CMD_SID_HELP_ZOOMIN                         ".uno:HelpZoomIn"
 -#define CMD_SID_HELP_ZOOMOUT                        ".uno:HelpZoomOut"
  #define CMD_SID_BASICIDE_HIDECURPAGE                ".uno:HideCurPage"
  #define CMD_SID_HYPERLINK_DIALOG                    ".uno:HyperlinkDialog"
 -#define CMD_SID_INSERTDOC                           ".uno:InsertDoc"
 -#define CMD_SID_HYPERLINK_INSERT                    ".uno:InsertHyperlink"
 -#define CMD_SID_INSERT_FLOATINGFRAME                ".uno:InsertObjectFloatingFrame"
 -#define CMD_SID_INTERNET_ONLINE                     ".uno:InternetOnline"
 -#define CMD_SID_INTERNET_SEARCH                     ".uno:InternetSearch"
 -#define CMD_SID_DOC_LOADING                         ".uno:IsLoading"
 -#define CMD_SID_IMG_LOADING                         ".uno:IsLoadingImages"
 -#define CMD_SID_PRINTOUT                            ".uno:IsPrinting"
 -#define CMD_SID_JUMPTOMARK                          ".uno:JumpToMark"
 -#define CMD_SID_DOCINFO_KEYWORDS                    ".uno:Keywords"
 -#define CMD_SID_BASICIDE_LIBLOADED                  ".uno:LibLoaded"
 -#define CMD_SID_BASICIDE_LIBREMOVED                 ".uno:LibRemoved"
 -#define CMD_SID_BASICIDE_LIBSELECTED                ".uno:LibSelect"
 -#define CMD_SID_BASICIDE_LIBSELECTOR                ".uno:LibSelector"
 -#define CMD_SID_OFFICE_PLK                          ".uno:LicenceKey"
 -#define CMD_SID_CONFIGACCEL                         ".uno:LoadAccel"
 -#define CMD_SID_BASICLOAD                           ".uno:LoadBasic"
 -#define CMD_SID_LOADCONFIG                          ".uno:LoadConfiguration"
 -#define CMD_SID_CONFIGEVENT                         ".uno:LoadEvents"
 -#define CMD_SID_CONFIGMENU                          ".uno:LoadMenu"
 -#define CMD_SID_CONFIGSTATUSBAR                     ".uno:LoadStatusBar"
 -#define CMD_SID_TOOLBOXOPTIONS                      ".uno:LoadToolBox"
 -#define CMD_SID_LOGOUT                              ".uno:Logout"
 -#define CMD_SID_SCRIPTORGANIZER                     ".uno:ScriptOrganizer"
 -#define CMD_SID_MACROORGANIZER                      ".uno:MacroOrganizer"
 -#define CMD_SID_RUNMACRO                            ".uno:RunMacro"
 -#define CMD_SID_BASICCHOOSER                        ".uno:MacroDialog"
 -#define CMD_SID_MAIL_NOTIFY                         ".uno:MailReceipt"
 -#define CMD_SID_MAIL_CHILDWIN                       ".uno:MailWindow"
 -#define CMD_SID_BASICIDE_MATCHGROUP                 ".uno:MatchGroup"
 -#define CMD_SID_TOGGLE_MENUBAR                      ".uno:MenuBarVisible"
 -#define CMD_SID_DOCUMENT_MERGE                      ".uno:MergeDocuments"
 -#define CMD_SID_ATTR_METRIC                         ".uno:MetricUnit"
 -#define CMD_SID_MODIFIED                            ".uno:Modified"
 -#define CMD_SID_DOC_MODIFIED                        ".uno:ModifiedStatus"
  #define CMD_SID_BASICIDE_MODULEDLG                  ".uno:ModuleDialog"
 -#define CMD_SID_BASICIDE_NAMECHANGEDONTAB           ".uno:NameChangedOnTab"
  #define CMD_SID_NAVIGATOR                           ".uno:Navigator"
 -#define CMD_SID_RESTORE_EDITING_VIEW                ".uno:RestoreEditingView"
  #define CMD_SID_BASICIDE_NEWDIALOG                  ".uno:NewDialog"
  #define CMD_SID_BASICIDE_NEWMODULE                  ".uno:NewModule"
 -#define CMD_SID_CREATE_BASICOBJECT                  ".uno:NewObject"
 -#define CMD_SID_STYLE_NEW                           ".uno:NewStyle"
 -#define CMD_SID_NEWWINDOW                           ".uno:NewWindow"
 -#define CMD_SID_BASICIDE_OBJCAT                     ".uno:ObjectCatalog"
  #define CMD_SID_OBJECT                              ".uno:ObjectMenue"
 -#define CMD_SID_OLD_PALK                            ".uno:OldPALK"
  #define CMD_SID_OPENDOC                             ".uno:Open"
+ #define CMD_SID_WEBHTML                             ".uno:WebHtml"
+ #define CMD_SID_OPENHYPERLINK                       ".uno:OpenHyperlink"
+ #define CMD_SID_DOCINFO_TITLE                       ".uno:DocInfoTitle"
+ #define CMD_SID_OPENTEMPLATE                        ".uno:OpenTemplate"
+ #define CMD_SID_OPENURL                             ".uno:OpenUrl"
+ #define CMD_SID_OPTIONS                             ".uno:Options"
+ #define CMD_SID_TEMPLATE_MANAGER                    ".uno:TemplateManager"
  #define CMD_SID_ORGANIZER                           ".uno:Organizer"
 -#define CMD_SID_STYLE_FAMILY4                       ".uno:PageStyle"
 -#define CMD_SID_STYLE_FAMILY2                       ".uno:ParaStyle"
 -#define CMD_SID_PARTWIN                             ".uno:PartWindow"
  #define CMD_SID_PASTE                               ".uno:Paste"
 -#define CMD_SID_CLIPBOARD_FORMAT_ITEMS              ".uno:ClipboardFormatItems"
  #define CMD_SID_PASTE_SPECIAL                       ".uno:PasteSpecial"
  #define CMD_SID_PASTE_ONLY                          ".uno:PasteOnly"
  #define CMD_SID_PASTE_ONLY_VALUE                    ".uno:PasteOnlyValue"
diff --cc sfx2/source/appl/appserv.cxx
index 084a2d6,5e83a9f..fadf7ea
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@@ -124,7 -125,7 +125,8 @@@
  #include <sfx2/dialogs.hrc>
  #include "sorgitm.hxx"
  #include "sfx2/sfxhelp.hxx"
 +#include <sfx2/zoomitem.hxx>
+ #include "templatedlg.hxx"
  
  using namespace ::com::sun::star;
  using namespace ::com::sun::star::beans;
commit fa99c1ea4f6d450cc12998d4513ed8cf77bafcc9
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Thu Jul 5 22:39:50 2012 -0430

    Update thumnails for all template operations.
    
    Change-Id: I7370e2ec459f64366277217b30875172104a72f6

diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index ef58cfe..c66148d 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -297,41 +297,30 @@ void TemplateFolderView::Populate ()
 
         sal_uInt16 nEntries = mpDocTemplates->GetCount(i);
 
-        if (nEntries)
+        for (sal_uInt16 j = 0; j < nEntries; ++j)
         {
-            /// Preview first 2 thumbnails for folder
-            pItem->maPreview1 = lcl_fetchThumbnail(mpDocTemplates->GetPath(i,0),
-                                                   THUMBNAIL_MAX_WIDTH*0.75,
-                                                   THUMBNAIL_MAX_HEIGHT*0.75);
+            rtl::OUString aName = mpDocTemplates->GetName(i,j);
+            rtl::OUString aURL = mpDocTemplates->GetPath(i,j);
+            rtl::OUString aType = SvFileInformationManager::GetDescription(INetURLObject(aURL));
 
-            if ( nEntries > 2 )
-                pItem->maPreview2 = lcl_fetchThumbnail(mpDocTemplates->GetPath(i,1),
-                                                       THUMBNAIL_MAX_WIDTH*0.75,
-                                                       THUMBNAIL_MAX_HEIGHT*0.75);
-
-            for (sal_uInt16 j = 0; j < nEntries; ++j)
+            if ((sal_uInt32)aName.getLength() > mpItemAttrs->nMaxTextLenght)
             {
-                rtl::OUString aName = mpDocTemplates->GetName(i,j);
-                rtl::OUString aURL = mpDocTemplates->GetPath(i,j);
-                rtl::OUString aType = SvFileInformationManager::GetDescription(INetURLObject(aURL));
-
-                if ((sal_uInt32)aName.getLength() > mpItemAttrs->nMaxTextLenght)
-                {
-                    aName = aName.copy(0,mpItemAttrs->nMaxTextLenght-3);
-                    aName += "...";
-                }
+                aName = aName.copy(0,mpItemAttrs->nMaxTextLenght-3);
+                aName += "...";
+            }
 
-                TemplateViewItem *pTemplateItem = new TemplateViewItem(*mpItemView,mpItemView);
-                pTemplateItem->mnId = j+1;
-                pTemplateItem->maText = aName;
-                pTemplateItem->setPath(aURL);
-                pTemplateItem->setFileType(aType);
-                pTemplateItem->maPreview1 = lcl_fetchThumbnail(aURL,THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_HEIGHT);
+            TemplateViewItem *pTemplateItem = new TemplateViewItem(*mpItemView,mpItemView);
+            pTemplateItem->mnId = j+1;
+            pTemplateItem->maText = aName;
+            pTemplateItem->setPath(aURL);
+            pTemplateItem->setFileType(aType);
+            pTemplateItem->maPreview1 = lcl_fetchThumbnail(aURL,THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_HEIGHT);
 
-                pItem->maTemplates.push_back(pTemplateItem);
-            }
+            pItem->maTemplates.push_back(pTemplateItem);
         }
 
+        lcl_updateThumbnails(pItem);
+
         mItemList.push_back(pItem);
     }
 
@@ -486,10 +475,15 @@ bool TemplateFolderView::removeTemplate (const sal_uInt16 nItemId)
                     pItem->maTemplates.erase(pIter);
 
                     mpItemView->RemoveItem(nItemId);
+
                     break;
                 }
             }
 
+            lcl_updateThumbnails(pItem);
+
+            CalculateItemPositions();
+
             break;
         }
     }
@@ -609,6 +603,10 @@ void TemplateFolderView::copyFrom (TemplateFolderViewItem *pItem, const rtl::OUS
         pTemplate->setFileType(SvFileInformationManager::GetDescription(INetURLObject(rPath)));
 
         pItem->maTemplates.push_back(pTemplate);
+
+        lcl_updateThumbnails(pItem);
+
+        CalculateItemPositions();
     }
 }
 
@@ -699,7 +697,7 @@ void lcl_updateThumbnails (TemplateFolderViewItem *pItem)
         }
         else
         {
-            pItem->maPreview1 = lcl_ScaleImg(pItem->maTemplates[i]->maPreview1,
+            pItem->maPreview2 = lcl_ScaleImg(pItem->maTemplates[i]->maPreview1,
                                             THUMBNAIL_MAX_WIDTH*0.75,
                                             THUMBNAIL_MAX_HEIGHT*0.75);
         }
commit 23c3e635a2c048692deb327bbc21866d19f1806e
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Thu Jul 5 21:11:25 2012 -0430

    Update folder thumbnails after moving or copying templates.
    
    Change-Id: I25596759c78a8898b5059db9c39b752f80075a2b

diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index 89479cd..ef58cfe 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -36,6 +36,8 @@
 #define INIT_VIEW_COLS 3
 #define INIT_VIEW_LINES 1
 
+void lcl_updateThumbnails (TemplateFolderViewItem *pItem);
+
 BitmapEx lcl_ScaleImg (const BitmapEx &rImg, long width, long height)
 {
     BitmapEx aImg = rImg;
@@ -576,6 +578,11 @@ bool TemplateFolderView::moveTemplates(std::set<const ThumbnailViewItem *> &rIte
 
     if (refresh)
     {
+        lcl_updateThumbnails(pSrc);
+        lcl_updateThumbnails(pTarget);
+
+        CalculateItemPositions();
+
         Invalidate();
         mpItemView->Invalidate();
     }
@@ -679,4 +686,24 @@ IMPL_LINK_NOARG(TemplateFolderView, OverlayCloseHdl)
     return 0;
 }
 
+void lcl_updateThumbnails (TemplateFolderViewItem *pItem)
+{
+    // Update folder thumbnails
+    for (size_t i = 0, n = pItem->maTemplates.size(); i < 2 && i < n; ++i)
+    {
+        if (i == 0)
+        {
+            pItem->maPreview1 = lcl_ScaleImg(pItem->maTemplates[i]->maPreview1,
+                                            THUMBNAIL_MAX_WIDTH*0.75,
+                                            THUMBNAIL_MAX_HEIGHT*0.75);
+        }
+        else
+        {
+            pItem->maPreview1 = lcl_ScaleImg(pItem->maTemplates[i]->maPreview1,
+                                            THUMBNAIL_MAX_WIDTH*0.75,
+                                            THUMBNAIL_MAX_HEIGHT*0.75);
+        }
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 6e21f93b752167b27e78055cffcdfd9898152a8a
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Thu Jul 5 20:47:11 2012 -0430

    Try to copy templates if moving them fails.
    
    Change-Id: I2e7e559ca84ad6155ac73aa324ed3c7f0eda0e4b

diff --git a/sfx2/inc/sfx2/templatefolderview.hxx b/sfx2/inc/sfx2/templatefolderview.hxx
index dac804b..df9860f 100644
--- a/sfx2/inc/sfx2/templatefolderview.hxx
+++ b/sfx2/inc/sfx2/templatefolderview.hxx
@@ -61,7 +61,7 @@ public:
 
     bool removeTemplate (const sal_uInt16 nItemId);
 
-    bool moveTemplates (std::set<const ThumbnailViewItem*> &rItems, const sal_uInt16 nTargetItem);
+    bool moveTemplates (std::set<const ThumbnailViewItem*> &rItems, const sal_uInt16 nTargetItem, bool bCopy);
 
     void copyFrom (TemplateFolderViewItem *pItem, const rtl::OUString &rPath);
 
diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index 43f8720..89479cd 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -495,7 +495,8 @@ bool TemplateFolderView::removeTemplate (const sal_uInt16 nItemId)
     return true;
 }
 
-bool TemplateFolderView::moveTemplates(std::set<const ThumbnailViewItem *> &rItems, const sal_uInt16 nTargetItem)
+bool TemplateFolderView::moveTemplates(std::set<const ThumbnailViewItem *> &rItems,
+                                       const sal_uInt16 nTargetItem, bool bCopy)
 {
     bool ret = true;
     bool refresh = false;
@@ -516,15 +517,22 @@ bool TemplateFolderView::moveTemplates(std::set<const ThumbnailViewItem *> &rIte
 
     if (pTarget && pSrc)
     {
+        sal_uInt16 nTargetRegion = pTarget->mnId-1;
+        sal_uInt16 nTargetIdx = mpDocTemplates->GetCount(nTargetRegion);    // Next Idx
+
         std::set<const ThumbnailViewItem*>::iterator aSelIter;
-        for ( aSelIter = rItems.begin(); aSelIter != rItems.end(); ++aSelIter )
+        for ( aSelIter = rItems.begin(); aSelIter != rItems.end(); ++aSelIter, ++nTargetIdx )
         {
             const TemplateViewItem *pViewItem = static_cast<const TemplateViewItem*>(*aSelIter);
 
-            sal_uInt16 nTargetRegion = pTarget->mnId-1;
-            sal_uInt16 nTargetIdx = mpDocTemplates->GetCount(nTargetRegion);    // Next Idx
+            bool bOK;
+
+            if (bCopy)
+                bOK = mpDocTemplates->Copy(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnId-1);
+            else
+                bOK = mpDocTemplates->Move(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnId-1);
 
-            if (!mpDocTemplates->Move(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnId-1))
+            if (!bOK)
             {
                 ret = false;
                 continue;
@@ -541,19 +549,22 @@ bool TemplateFolderView::moveTemplates(std::set<const ThumbnailViewItem *> &rIte
 
             pTarget->maTemplates.push_back(pTemplateItem);
 
-            // remove template for overlay and from cached data
-
-            std::vector<TemplateViewItem*>::iterator pIter;
-            for (pIter = pSrc->maTemplates.begin(); pIter != pSrc->maTemplates.end(); ++pIter)
+            if (!bCopy)
             {
-                if ((*pIter)->mnId == pViewItem->mnId)
+                // remove template for overlay and from cached data
+
+                std::vector<TemplateViewItem*>::iterator pIter;
+                for (pIter = pSrc->maTemplates.begin(); pIter != pSrc->maTemplates.end(); ++pIter)
                 {
-                    delete *pIter;
+                    if ((*pIter)->mnId == pViewItem->mnId)
+                    {
+                        delete *pIter;
 
-                    pSrc->maTemplates.erase(pIter);
+                        pSrc->maTemplates.erase(pIter);
 
-                    mpItemView->RemoveItem(pViewItem->mnId);
-                    break;
+                        mpItemView->RemoveItem(pViewItem->mnId);
+                        break;
+                    }
                 }
             }
 
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 819c3ab..77f9032 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -500,8 +500,14 @@ IMPL_LINK(SfxTemplateManagerDlg, MoveMenuSelectHdl, Menu*, pMenu)
             {
                 sal_uInt16 nNewRegionId = maView->createRegion(aName);
 
-                if (nNewRegionId && !maView->moveTemplates(maSelTemplates,nNewRegionId))
+                if (nNewRegionId)
                 {
+                    // Move templates to desired folder if for some reason move fails
+                    // try copying them.
+                    if (!maView->moveTemplates(maSelTemplates,nNewRegionId,false) &&
+                            !maView->moveTemplates(maSelTemplates,nNewRegionId,true))
+                    {
+                    }
                 }
             }
         }
@@ -519,7 +525,12 @@ IMPL_LINK(SfxTemplateManagerDlg, MoveMenuSelectHdl, Menu*, pMenu)
     }
     else
     {
-        if (!maView->moveTemplates(maSelTemplates,maView->GetItemId(nMenuId-MNI_MOVE_FOLDER_BASE)))
+        // Try to move the template, if isnt possible try to copy it.
+
+        sal_uInt16 nItemId = maView->GetItemId(nMenuId-MNI_MOVE_FOLDER_BASE);
+
+        if (!maView->moveTemplates(maSelTemplates,nItemId,false) &&
+                !maView->moveTemplates(maSelTemplates,nItemId,true))
         {
         }
     }
commit 25e1e3cbf6f49d893ba67d2def850167d54b3f58
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Thu Jul 5 20:23:44 2012 -0430

    Fix WaE.
    
    Change-Id: If7df918d272fcfede7d9b36619937b06a28d485a

diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index 022fb47..43f8720 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -282,7 +282,7 @@ void TemplateFolderView::Populate ()
     {
         rtl::OUString aRegionName(mpDocTemplates->GetFullRegionName(i));
 
-        if (aRegionName.getLength() > mpItemAttrs->nMaxTextLenght)
+        if ((sal_uInt32)aRegionName.getLength() > mpItemAttrs->nMaxTextLenght)
         {
             aRegionName = aRegionName.copy(0,mpItemAttrs->nMaxTextLenght-3);
             aRegionName += "...";
@@ -313,7 +313,7 @@ void TemplateFolderView::Populate ()
                 rtl::OUString aURL = mpDocTemplates->GetPath(i,j);
                 rtl::OUString aType = SvFileInformationManager::GetDescription(INetURLObject(aURL));
 
-                if (aName.getLength() > mpItemAttrs->nMaxTextLenght)
+                if ((sal_uInt32)aName.getLength() > mpItemAttrs->nMaxTextLenght)
                 {
                     aName = aName.copy(0,mpItemAttrs->nMaxTextLenght-3);
                     aName += "...";
@@ -438,7 +438,7 @@ sal_uInt16 TemplateFolderView::createRegion(const rtl::OUString &rName)
 
     rtl::OUString aRegionName = rName;
 
-    if (aRegionName.getLength() > (sal_Int32)mpItemAttrs->nMaxTextLenght)
+    if ((sal_uInt32)aRegionName.getLength() > mpItemAttrs->nMaxTextLenght)
     {
         aRegionName = aRegionName.copy(0,mpItemAttrs->nMaxTextLenght-3);
         aRegionName += "...";
commit 551948e6239926c414e2f26c95d0a71f7b88a355
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Thu Jul 5 20:14:00 2012 -0430

    Fix moving templates between folders.
    
    Change-Id: I1befe0add1bdff518c4553a8116d4fed235fd1b8

diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index 4f39428..022fb47 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -519,17 +519,18 @@ bool TemplateFolderView::moveTemplates(std::set<const ThumbnailViewItem *> &rIte
         std::set<const ThumbnailViewItem*>::iterator aSelIter;
         for ( aSelIter = rItems.begin(); aSelIter != rItems.end(); ++aSelIter )
         {
+            const TemplateViewItem *pViewItem = static_cast<const TemplateViewItem*>(*aSelIter);
+
             sal_uInt16 nTargetRegion = pTarget->mnId-1;
-            sal_uInt16 nTargetIdx = pTarget->maTemplates.back()->mnId; // Last Assigned in filesystem is mnId-1
+            sal_uInt16 nTargetIdx = mpDocTemplates->GetCount(nTargetRegion);    // Next Idx
 
-            if (!mpDocTemplates->Move(nTargetRegion,nTargetIdx,mpItemView->getRegionId(),(*aSelIter)->mnId-1))
+            if (!mpDocTemplates->Move(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnId-1))
             {
                 ret = false;
                 continue;
             }
 
             // move template to destination
-            const TemplateViewItem *pViewItem = static_cast<const TemplateViewItem*>(*aSelIter);
 
             TemplateViewItem *pTemplateItem = new TemplateViewItem(*mpItemView,mpItemView);
             pTemplateItem->mnId = nTargetIdx + 1;
commit 2691b4db8242aa82c7c77a54902ae112fae635d0
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Thu Jul 5 19:44:40 2012 -0430

    Display all folders even if theyre empty.
    
    Change-Id: I3b7db9adf513d0c3aa8c70c7f6edc5b690504eff

diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index 1035944..4f39428 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -288,15 +288,15 @@ void TemplateFolderView::Populate ()
             aRegionName += "...";
         }
 
+        TemplateFolderViewItem* pItem = new TemplateFolderViewItem( *this, this );
+        pItem->mnId = i+1;
+        pItem->maText = aRegionName;
+        pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnFolderSelected));
+
         sal_uInt16 nEntries = mpDocTemplates->GetCount(i);
 
         if (nEntries)
         {
-            TemplateFolderViewItem* pItem = new TemplateFolderViewItem( *this, this );
-            pItem->mnId = i+1;
-            pItem->maText = aRegionName;
-            pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnFolderSelected));
-
             /// Preview first 2 thumbnails for folder
             pItem->maPreview1 = lcl_fetchThumbnail(mpDocTemplates->GetPath(i,0),
                                                    THUMBNAIL_MAX_WIDTH*0.75,
@@ -328,9 +328,9 @@ void TemplateFolderView::Populate ()
 
                 pItem->maTemplates.push_back(pTemplateItem);
             }
-
-            mItemList.push_back(pItem);
         }
+
+        mItemList.push_back(pItem);
     }
 
     CalculateItemPositions();
commit e1301a4087bcba029665a3a8dd99888470c980dc
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Thu Jul 5 18:55:41 2012 -0430

    Implement move templates to a new region.
    
    Change-Id: I57597a39e3af80e6e25f46eac17e888f99b5482a

diff --git a/sfx2/inc/sfx2/templatefolderview.hxx b/sfx2/inc/sfx2/templatefolderview.hxx
index ae5f6a1..dac804b 100644
--- a/sfx2/inc/sfx2/templatefolderview.hxx
+++ b/sfx2/inc/sfx2/templatefolderview.hxx
@@ -57,7 +57,7 @@ public:
 
     void setTemplateStateHdl (const Link &aLink) { maTemplateStateHdl = aLink; }
 
-    bool createRegion (const rtl::OUString &rName, const std::set<const ThumbnailViewItem*> &rItems);
+    sal_uInt16 createRegion (const rtl::OUString &rName);
 
     bool removeTemplate (const sal_uInt16 nItemId);
 
diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index fc9b372..1035944 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -36,6 +36,18 @@
 #define INIT_VIEW_COLS 3
 #define INIT_VIEW_LINES 1
 
+BitmapEx lcl_ScaleImg (const BitmapEx &rImg, long width, long height)
+{
+    BitmapEx aImg = rImg;
+
+    int sWidth = std::min(aImg.GetSizePixel().getWidth(),width);
+    int sHeight = std::min(aImg.GetSizePixel().getHeight(),height);
+
+    aImg.Scale(Size(sWidth,sHeight),BMP_SCALE_INTERPOLATE);
+
+    return aImg;
+}
+
 BitmapEx lcl_fetchThumbnail (const rtl::OUString &msURL, long width, long height)
 {
     using namespace ::com::sun::star;
@@ -142,15 +154,7 @@ BitmapEx lcl_fetchThumbnail (const rtl::OUString &msURL, long width, long height
         aThumbnail = aReader.Read ();
     }
 
-    int sWidth = std::min(aThumbnail.GetSizePixel().getWidth(),width);
-    int sHeight = std::min(aThumbnail.GetSizePixel().getHeight(),height);
-
-    aThumbnail.Scale(Size(sWidth,sHeight),BMP_SCALE_INTERPOLATE);
-
-    // Note that the preview is returned without scaling it to the desired
-    // width.  This gives the caller the chance to take advantage of a
-    // possibly larger resolution then was asked for.
-    return aThumbnail;
+    return lcl_ScaleImg(aThumbnail,width,height);
 }
 
 // Display template items depending on the generator application
@@ -425,8 +429,33 @@ void TemplateFolderView::sortOverlayItems(const boost::function<bool (const Thum
     mpItemView->sortItems(func);
 }
 
-bool TemplateFolderView::createRegion(const rtl::OUString &rName, const std::set<const ThumbnailViewItem*> &rItems)
+sal_uInt16 TemplateFolderView::createRegion(const rtl::OUString &rName)
 {
+    sal_uInt16 nRegionId = mpDocTemplates->GetRegionCount();    // Next regionId
+
+    if (!mpDocTemplates->InsertDir(rName,nRegionId))
+        return false;
+
+    rtl::OUString aRegionName = rName;
+
+    if (aRegionName.getLength() > (sal_Int32)mpItemAttrs->nMaxTextLenght)
+    {
+        aRegionName = aRegionName.copy(0,mpItemAttrs->nMaxTextLenght-3);
+        aRegionName += "...";
+    }
+
+    TemplateFolderViewItem* pItem = new TemplateFolderViewItem( *this, this );
+    pItem->mnId = nRegionId+1;
+    pItem->maText = aRegionName;
+    pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnFolderSelected));
+
+    mItemList.push_back(pItem);
+
+    CalculateItemPositions();
+
+    if ( IsReallyVisible() && IsUpdateMode() )
+        Invalidate();
+
     return true;
 }
 
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 5c6747f..819c3ab 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -498,7 +498,9 @@ IMPL_LINK(SfxTemplateManagerDlg, MoveMenuSelectHdl, Menu*, pMenu)
 
             if (!aName.isEmpty())
             {
-                if (!maView->createRegion(aName,maSelTemplates))
+                sal_uInt16 nNewRegionId = maView->createRegion(aName);
+
+                if (nNewRegionId && !maView->moveTemplates(maSelTemplates,nNewRegionId))
                 {
                 }
             }
commit 2168ee056253def18c43a6b13dbdfd0a992de2df
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Wed Jul 4 12:52:28 2012 -0430

    Create new folder after getting input text with selected templates.
    
    Change-Id: I8eb788e9158f5016f60ae344543859ac4e403ebe

diff --git a/sfx2/inc/sfx2/templatefolderview.hxx b/sfx2/inc/sfx2/templatefolderview.hxx
index 1e0c2b5..ae5f6a1 100644
--- a/sfx2/inc/sfx2/templatefolderview.hxx
+++ b/sfx2/inc/sfx2/templatefolderview.hxx
@@ -57,6 +57,8 @@ public:
 
     void setTemplateStateHdl (const Link &aLink) { maTemplateStateHdl = aLink; }
 
+    bool createRegion (const rtl::OUString &rName, const std::set<const ThumbnailViewItem*> &rItems);
+
     bool removeTemplate (const sal_uInt16 nItemId);
 
     bool moveTemplates (std::set<const ThumbnailViewItem*> &rItems, const sal_uInt16 nTargetItem);
diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index d202293..fc9b372 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -425,6 +425,11 @@ void TemplateFolderView::sortOverlayItems(const boost::function<bool (const Thum
     mpItemView->sortItems(func);
 }
 
+bool TemplateFolderView::createRegion(const rtl::OUString &rName, const std::set<const ThumbnailViewItem*> &rItems)
+{
+    return true;
+}
+
 bool TemplateFolderView::removeTemplate (const sal_uInt16 nItemId)
 {
     sal_uInt16 nRegionId = mpItemView->getRegionId();
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 29d664a..5c6747f 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -491,6 +491,18 @@ IMPL_LINK(SfxTemplateManagerDlg, MoveMenuSelectHdl, Menu*, pMenu)
         InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
 
         int ret = dlg.Execute();
+
+        if (ret)
+        {
+            rtl::OUString aName = dlg.getEntryText();
+
+            if (!aName.isEmpty())
+            {
+                if (!maView->createRegion(aName,maSelTemplates))
+                {
+                }
+            }
+        }
     }
     else if (nMenuId == MNI_MOVE_DELETE)
     {
commit cca67621756705365365eb904dff4171bfb5020d
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Wed Jul 4 12:35:45 2012 -0430

    Connect button click handlers and end dialog with the desired result.
    
    Change-Id: Ib87bd61c1cc7da906304c8ca43cd38d9a7bb1fcf

diff --git a/sfx2/source/dialog/inputdlg.cxx b/sfx2/source/dialog/inputdlg.cxx
index 74405c8..c1bd505 100644
--- a/sfx2/source/dialog/inputdlg.cxx
+++ b/sfx2/source/dialog/inputdlg.cxx
@@ -55,6 +55,9 @@ InputDialog::InputDialog (const rtl::OUString &rLabelText, Window *pParent)
 
     aBtnPos.setX(aBtnPos.getX() - aBtnSize.getWidth() - LABEL_TEXT_SPACE);
     mpOK->SetPosPixel(aBtnPos);
+
+    mpOK->SetClickHdl(LINK(this,InputDialog,ClickHdl));
+    mpCancel->SetClickHdl(LINK(this,InputDialog,ClickHdl));
 }
 
 InputDialog::~InputDialog()
@@ -70,6 +73,12 @@ rtl::OUString InputDialog::getEntryText () const
     return mpEntry->GetText();
 }
 
+IMPL_LINK(InputDialog,ClickHdl,PushButton*, pButton)
+{
+    EndDialog(pButton == mpOK ? true : false);
+    return 0;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 
 
diff --git a/sfx2/source/inc/inputdlg.hxx b/sfx2/source/inc/inputdlg.hxx
index 0df999d..1dce2fb 100644
--- a/sfx2/source/inc/inputdlg.hxx
+++ b/sfx2/source/inc/inputdlg.hxx
@@ -28,6 +28,10 @@ public:
 
 private:
 
+    DECL_LINK(ClickHdl, PushButton*);
+
+private:
+
     Edit *mpEntry;
     FixedText *mpLabel;
     PushButton *mpOK;
commit 7887eeba65abbc19f912a4c5fc67e9699e3f438b
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Wed Jul 4 12:23:26 2012 -0430

    Set correct dimensions and positions of inputbox widget.
    
    Change-Id: I31f92f4af90865d8713f50031c08a6fd4498d885

diff --git a/sfx2/AllLangResTarget_sfx2.mk b/sfx2/AllLangResTarget_sfx2.mk
index 418b710..a0bf204 100644
--- a/sfx2/AllLangResTarget_sfx2.mk
+++ b/sfx2/AllLangResTarget_sfx2.mk
@@ -63,6 +63,7 @@ $(eval $(call gb_SrsTarget_add_files,sfx/res,\
     sfx2/source/dialog/dinfdlg.src \
     sfx2/source/dialog/dinfedt.src \
     sfx2/source/dialog/filedlghelper.src \
+    sfx2/source/dialog/inputdlg.src \
     sfx2/source/dialog/mailwindow.src \
     sfx2/source/dialog/mgetempl.src \
     sfx2/source/dialog/newstyle.src \
diff --git a/sfx2/source/dialog/inputdlg.cxx b/sfx2/source/dialog/inputdlg.cxx
index 41d5d4f..74405c8 100644
--- a/sfx2/source/dialog/inputdlg.cxx
+++ b/sfx2/source/dialog/inputdlg.cxx
@@ -9,43 +9,60 @@
 
 #include "inputdlg.hxx"
 
+#include "inputdlg.hrc"
+
+#include <sfx2/sfxresid.hxx>
 #include <vcl/button.hxx>
 #include <vcl/edit.hxx>
 #include <vcl/fixed.hxx>
 
-#define LABEL_TEXT_SPACE 10
-#define DIALOG_BORDER 10
-#define MAX_FOLDER_NAME_LENGTH 20
+#define LABEL_TEXT_SPACE 5
 
 InputDialog::InputDialog (const rtl::OUString &rLabelText, Window *pParent)
-    : ModalDialog(pParent),
-      mpEntry(new Edit(this)),
-      mpLabel(new FixedText(this))
+    : ModalDialog(pParent,SfxResId(DLG_INPUT_BOX)),
+      mpEntry(new Edit(this,SfxResId(EDT_INPUT_FIELD))),
+      mpLabel(new FixedText(this,SfxResId(LABEL_INPUT_TEXT))),
+      mpOK(new PushButton(this,SfxResId(BTN_INPUT_OK))),
+      mpCancel(new PushButton(this,SfxResId(BTN_INPUT_CANCEL)))
 {
     SetStyle(GetStyle() | WB_CENTER | WB_VCENTER);
 
-    Point aPos(DIALOG_BORDER,DIALOG_BORDER);
+    mpLabel->SetText(rLabelText);
+
+    // Fit label size to text and reposition edit box
+    Size aLabelSize = mpLabel->CalcMinimumSize();
+    Size aEditSize = mpEntry->GetSizePixel();
+    Size aBtnSize = mpOK->GetSizePixel();
 
-    Size aTextSize = mpLabel->CalcMinimumTextSize(mpLabel,100);
-    Size aEntrySize = mpEntry->CalcSize(MAX_FOLDER_NAME_LENGTH);
+    Point aLabelPos = mpLabel->GetPosPixel();
+    Point aEditPos = mpEntry->GetPosPixel();
 
-    aTextSize.setWidth(aEntrySize.getHeight());
+    aEditPos.setX(aLabelPos.getX() + aLabelSize.getWidth() + LABEL_TEXT_SPACE);
 
-    mpLabel->SetPosPixel(Point(DIALOG_BORDER,DIALOG_BORDER));
-    mpLabel->SetSizePixel(aTextSize);
-    mpLabel->SetText(String("Enter name"));
+    mpLabel->SetPosSizePixel(aLabelPos,aLabelSize);
+    mpEntry->SetPosSizePixel(aEditPos,aEditSize);
 
-    aPos.setX(DIALOG_BORDER + aTextSize.getWidth() + LABEL_TEXT_SPACE + DIALOG_BORDER);
+    // Resize window if needed
+    Size aWinSize = GetOutputSize();
+    aWinSize.setWidth(aEditPos.getX() + aEditSize.getWidth() + LABEL_TEXT_SPACE);
+    SetSizePixel(aWinSize);
 
-    mpEntry->SetPosPixel(aPos);
-    mpEntry->SetSizePixel(aEntrySize);
+    // Align buttons
+    Point aBtnPos = mpCancel->GetPosPixel();
 
-    // Set windows correct size
-    SetSizePixel(Size(aTextSize.getWidth() + aEntrySize.getWidth() + 2*DIALOG_BORDER,
-                      aTextSize.getHeight()+2*DIALOG_BORDER));
+    aBtnPos.setX(aWinSize.getWidth() - aBtnSize.getWidth() - LABEL_TEXT_SPACE);
+    mpCancel->SetPosPixel(aBtnPos);
 
-    mpEntry->Show();
-    mpLabel->Show();
+    aBtnPos.setX(aBtnPos.getX() - aBtnSize.getWidth() - LABEL_TEXT_SPACE);
+    mpOK->SetPosPixel(aBtnPos);
+}
+
+InputDialog::~InputDialog()
+{
+    delete mpEntry;
+    delete mpLabel;
+    delete mpOK;
+    delete mpCancel;
 }
 
 rtl::OUString InputDialog::getEntryText () const
diff --git a/sfx2/source/dialog/inputdlg.hrc b/sfx2/source/dialog/inputdlg.hrc
index b9fdf70..bb9edd8 100644
--- a/sfx2/source/dialog/inputdlg.hrc
+++ b/sfx2/source/dialog/inputdlg.hrc
@@ -5,3 +5,9 @@
  * 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/.
  */
+
+#define DLG_INPUT_BOX       256
+#define LABEL_INPUT_TEXT    2
+#define EDT_INPUT_FIELD     3
+#define BTN_INPUT_OK        4
+#define BTN_INPUT_CANCEL    5
diff --git a/sfx2/source/dialog/inputdlg.src b/sfx2/source/dialog/inputdlg.src
index cece9f8..edd16d6 100644
--- a/sfx2/source/dialog/inputdlg.src
+++ b/sfx2/source/dialog/inputdlg.src
@@ -8,3 +8,41 @@
 
 #include "inputdlg.hrc"
 
+ModalDialog DLG_INPUT_BOX
+{
+    OutputSize = TRUE;
+    SVLook = TRUE;
+    Moveable = TRUE;
+    Closeable = TRUE;
+    Size = MAP_APPFONT ( 215, 40 );
+
+    FixedText LABEL_INPUT_TEXT
+    {
+        Pos = MAP_APPFONT(5,6);
+        Size = MAP_APPFONT(80,10);
+    };
+
+    Edit EDT_INPUT_FIELD
+    {
+        Border = TRUE;
+        Pos = MAP_APPFONT(90,5);
+        Size = MAP_APPFONT(120,10);
+    };
+
+    PushButton BTN_INPUT_OK
+    {
+        Pos = MAP_APPFONT(125,20);
+        Size = MAP_APPFONT(40,15);
+        TabStop = TRUE;
+        DefButton = TRUE;
+        Text [en-US] = "Accept";
+    };
+
+    PushButton BTN_INPUT_CANCEL
+    {
+        Pos = MAP_APPFONT(170,20);
+        Size = MAP_APPFONT(40,15);
+        TabStop = TRUE;
+        Text [en-US] = "Cancel";
+    };
+};
diff --git a/sfx2/source/inc/inputdlg.hxx b/sfx2/source/inc/inputdlg.hxx
index 7e09c9f..0df999d 100644
--- a/sfx2/source/inc/inputdlg.hxx
+++ b/sfx2/source/inc/inputdlg.hxx
@@ -22,6 +22,8 @@ public:
 
     InputDialog (const rtl::OUString &labelText, Window *pParent = NULL);
 
+    virtual ~InputDialog();
+
     rtl::OUString getEntryText () const;
 
 private:
commit 40ec7e20e369f241a748808ba85fd5fc34980eb5
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Wed Jul 4 11:11:40 2012 -0430

    Remove unused method.
    
    Change-Id: I5b084fa1aa88ef7d1e55700033b05c57a0979ea2

diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index 3698381..2efa11d 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -70,7 +70,6 @@ private:
     void OnTemplateSearch ();
     void OnTemplateEdit ();
     void OnTemplateProperties ();
-    void OnTemplateMove ();
     void OnTemplateDelete ();
 
 private:
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index a7cf3c0..29d664a 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -323,9 +323,6 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg,TBXTemplateHdl)
     case TBI_TEMPLATE_PROPERTIES:
         OnTemplateProperties();
         break;
-    case TBI_TEMPLATE_MOVE:
-        OnTemplateMove();
-        break;
     case TBI_TEMPLATE_DELETE:
         OnTemplateDelete();
         break;
@@ -723,10 +720,6 @@ void SfxTemplateManagerDlg::OnTemplateProperties ()
 {
 }
 
-void SfxTemplateManagerDlg::OnTemplateMove ()
-{
-}
-
 void SfxTemplateManagerDlg::OnTemplateDelete ()
 {
     std::set<const ThumbnailViewItem*>::const_iterator pIter;
commit 41e17582a92acdbe533106ddfac44368543fe2e0
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Wed Jul 4 11:10:02 2012 -0430

    Make title edit box 50% of the overlay width.
    
    Change-Id: If8fb15738c0c87f67a39ae53f36e7f3839ca7dcc

diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx
index 71f3b70..1ffd1c8 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -25,7 +25,6 @@
 
 #include "templateview.hrc"
 
-#define EDIT_WIDTH 180
 #define EDIT_HEIGHT 20
 
 using namespace basegfx;
@@ -42,8 +41,6 @@ TemplateView::TemplateView (Window *pParent, SfxDocumentTemplates *pTemplates)
       mpEditName(new Edit(this, WB_BORDER | WB_HIDE))
 {
     mnHeaderHeight = 30;
-
-    mpEditName->SetSizePixel(Size(EDIT_WIDTH,EDIT_HEIGHT));
 }
 
 TemplateView::~TemplateView ()
@@ -134,14 +131,15 @@ void TemplateView::InsertItems (const std::vector<TemplateViewItem*> &rTemplates
 void TemplateView::Resize()
 {
     // Set editbox size and position
-    Size aEditSize = mpEditName->GetSizePixel();
     Size aWinSize = GetOutputSize();
 
+    Size aEditSize(aWinSize.getWidth()/2,EDIT_HEIGHT);
+
     Point aPos;
     aPos.X() = (aWinSize.getWidth() - aEditSize.getWidth())/2;
     aPos.Y() = (mnHeaderHeight - aEditSize.getHeight())/2;
 
-    mpEditName->SetPosPixel(aPos);
+    mpEditName->SetPosSizePixel(aPos,aEditSize);
 
     ThumbnailView::Resize();
 }
commit d431029cfa3d84935c7d9fdcb5bdcc50943ff280
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Wed Jul 4 10:53:30 2012 -0430

    Remove deprecated method.
    
    Change-Id: I60bae94c3d86d48f570ae687f16400e034be872c

diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx
index 8934b58..0ed278c 100644
--- a/sfx2/inc/sfx2/templateview.hxx
+++ b/sfx2/inc/sfx2/templateview.hxx
@@ -33,8 +33,6 @@ public:
 
     virtual void Paint (const Rectangle &rRect);
 
-    void InsertItem (const TemplateViewItem *pItem);
-
     void InsertItems (const std::vector<TemplateViewItem*> &rTemplates);
 
     void setDblClickHdl (const Link &rLink) { maDblClickHdl = rLink; }
diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx
index d9748f5..71f3b70 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -109,23 +109,6 @@ void TemplateView::Paint (const Rectangle &rRect)
     mpProcessor->process(aSeq);
 }
 
-void TemplateView::InsertItem (const TemplateViewItem *pItem)
-{
-    TemplateViewItem *pCloneItem = new TemplateViewItem(*this,this);
-
-    pCloneItem->mnId = pItem->mnId;
-    pCloneItem->maText = pItem->maText;
-    pCloneItem->setPath(pItem->getPath());
-    pCloneItem->setFileType(pItem->getFileType());
-    pCloneItem->maPreview1 = pItem->maPreview1;
-
-    mItemList.push_back(pCloneItem);
-
-    CalculateItemPositions();
-
-    Invalidate();
-}
-
 void TemplateView::InsertItems (const std::vector<TemplateViewItem*> &rTemplates)
 {
     for (size_t i = 0, n = rTemplates.size(); i < n; ++i )
commit 4f93db78598c412b692dd08bdce6138d04097e11
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Wed Jul 4 10:25:41 2012 -0430

    Delete search view when dialog gets destroyed.
    
    Change-Id: I82612d5854ef4db5b0bfe4e245e43cf14cf6fd4d

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 7f86129..a7cf3c0 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -231,6 +231,7 @@ SfxTemplateManagerDlg::~SfxTemplateManagerDlg ()
     delete mpViewBar;
     delete mpActionBar;
     delete mpTemplateBar;
+    delete mpSearchView;
     delete maView;
     delete mpCreateMenu;
     delete mpActionMenu;
commit 1ceca7ac90cfc6d07ff0bd1357c640180c900553
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Wed Jul 4 10:09:40 2012 -0430

    Fetch and display templates that contains the search keyword.
    
    Change-Id: I248bcf7fb1a0248fdbb1cd4e57c815b3d5d0b28b

diff --git a/sfx2/inc/sfx2/templatefolderview.hxx b/sfx2/inc/sfx2/templatefolderview.hxx
index b1dcade..1e0c2b5 100644
--- a/sfx2/inc/sfx2/templatefolderview.hxx
+++ b/sfx2/inc/sfx2/templatefolderview.hxx
@@ -49,6 +49,9 @@ public:
 
     void filterTemplatesByApp (const FILTER_APPLICATION &eApp);
 
+    std::vector<std::pair<sal_uInt16,std::vector<ThumbnailViewItem*> > >
+        getFilteredItems (const boost::function<bool (const ThumbnailViewItem*) > &rFunc) const;
+
     void sortOverlayItems (const boost::function<bool (const ThumbnailViewItem*,
                                                        const ThumbnailViewItem*) > &func);
 
diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index e8b01f5..d202293 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -394,6 +394,31 @@ void TemplateFolderView::filterTemplatesByApp (const FILTER_APPLICATION &eApp)
     }
 }
 
+std::vector<std::pair<sal_uInt16,std::vector<ThumbnailViewItem*> > >
+TemplateFolderView::getFilteredItems(const boost::function<bool (const ThumbnailViewItem*) > &rFunc) const
+{
+    std::vector<ThumbnailViewItem*> aRegionItems;
+    std::vector<std::pair<sal_uInt16,std::vector<ThumbnailViewItem*> > > aItems;
+
+    for (size_t i = 0; i < mItemList.size(); ++i)
+    {
+        TemplateFolderViewItem *pFolderItem = static_cast<TemplateFolderViewItem*>(mItemList[i]);
+
+        sal_uInt16 nRegionId = pFolderItem->mnId-1;
+
+        for (size_t j = 0; j < pFolderItem->maTemplates.size(); ++j)
+        {
+            if (rFunc(pFolderItem->maTemplates[j]))
+                aRegionItems.push_back(pFolderItem->maTemplates[j]);
+        }
+
+        aItems.push_back(std::make_pair(nRegionId,aRegionItems));
+        aRegionItems.clear();
+    }
+
+    return aItems;
+}
+
 void TemplateFolderView::sortOverlayItems(const boost::function<bool (const ThumbnailViewItem*,
                                                                       const ThumbnailViewItem*) > &func)
 {
diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx
index dbcf0d1..fa6eabc 100644
--- a/sfx2/source/control/templatesearchview.cxx
+++ b/sfx2/source/control/templatesearchview.cxx
@@ -47,6 +47,8 @@ void TemplateSearchView::AppendItem(sal_uInt16 nItemId, sal_uInt16 nRegionId, sa
     pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnFolderSelected));
 
     mItemList.push_back(pItem);
+
+    CalculateItemPositions();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 13db34c..7f86129 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -64,6 +64,24 @@ public:
     }
 };
 
+class SearchView_Keyword
+{
+public:
+
+    SearchView_Keyword (const rtl::OUString &rKeyword)
+        : maKeyword(rKeyword)
+    {}
+
+    bool operator() (const ThumbnailViewItem *pItem)
+    {
+        return pItem->maText.indexOf(maKeyword) != -1;
+    }
+
+private:
+
+    rtl::OUString maKeyword;
+};
+
 SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
     : ModalDialog(parent, SfxResId(DLG_TEMPLATE_MANAGER)),
       aButtonAll(this,SfxResId(BTN_SELECT_ALL)),
@@ -523,11 +541,40 @@ IMPL_LINK (SfxTemplateManagerDlg, SearchUpdateHdl, Edit*, pEdit)
     // if the search view is hidden, hide the folder view and display search one
     if (!mpSearchView->IsVisible())
     {
+        mpSearchView->Clear();
         mpSearchView->Show();
         maView->Hide();
     }
 
-    mpSearchView->Clear();
+    rtl::OUString aKeyword = mpSearchEdit->GetText();
+
+    if (!aKeyword.isEmpty())
+    {
+        mpSearchView->Clear();
+
+        std::vector<std::pair<sal_uInt16,std::vector<ThumbnailViewItem*> > > aItems =
+                maView->getFilteredItems(SearchView_Keyword(aKeyword));
+
+        size_t nCounter = 0;
+        for (size_t i = 0; i < aItems.size(); ++i)
+        {
+            sal_uInt16 nRegionId = aItems[i].first;
+            std::vector<ThumbnailViewItem*> &rRegionItems = aItems[i].second;
+
+            for (size_t j = 0; j < rRegionItems.size(); ++j)
+            {
+                TemplateViewItem *pItem = static_cast<TemplateViewItem*>(rRegionItems[j]);
+
+                mpSearchView->AppendItem(++nCounter,nRegionId,
+                                         pItem->mnId-1,
+                                         pItem->maText,
+                                         pItem->getPath(),
+                                         pItem->maPreview1);
+            }
+        }
+
+        mpSearchView->Invalidate();
+    }
 
     return 0;
 }
commit 822532024d078685ab6baa59673d46645dde74de
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Wed Jul 4 09:46:29 2012 -0430

    Set search view size an position.
    
    Change-Id: Ifed9e633ef73c4248fa67adc8b0e90dd2c484dbd

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 927dff6..13db34c 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -170,6 +170,13 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
     maView->setTemplateStateHdl(LINK(this,SfxTemplateManagerDlg,TVTemplateStateHdl));
     maView->setOverlayDblClickHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl));
 
+    mpSearchView->SetSizePixel(aThumbSize);
+    mpSearchView->setItemMaxTextLength(ITEM_MAX_TEXT_LENGTH);
+
+    mpSearchView->setItemDimensions(ITEM_MAX_WIDTH,THUMBNAIL_MAX_HEIGHT,
+                                    ITEM_MAX_HEIGHT-THUMBNAIL_MAX_HEIGHT,
+                                    ITEM_PADDING);
+
     // Set OK button position
     Point aBtnPos;
     Size aBtnSize = maButtonClose.GetSizePixel();
@@ -626,6 +633,7 @@ void SfxTemplateManagerDlg::OnTemplateSearch ()
 
     SetSizePixel(aWinSize);
     maView->SetPosPixel(aPos);
+    mpSearchView->SetPosPixel(aPos);
     maButtonClose.SetPosPixel(aClosePos);
 
     // Hide search view
commit c11eff1e28f462ee2371fa9283cd9baa5cb8e5e9
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Wed Jul 4 09:03:59 2012 -0430

    Dont cache search term when you finish searching.
    
    Change-Id: I2975bd530dc2377d8b2e0003f9a5c5986d270d6a

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 018e98d..927dff6 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -636,6 +636,7 @@ void SfxTemplateManagerDlg::OnTemplateSearch ()
     }
 
     mpSearchEdit->Show(!bVisible);
+    mpSearchEdit->SetText(rtl::OUString());
 }
 
 void SfxTemplateManagerDlg::OnTemplateEdit ()
commit 74780aa9a984df9d8556abc9a299ece4dbedb0d1
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Wed Jul 4 08:53:29 2012 -0430

    Create a view to display search results.
    
    Change-Id: I85b34937a91dbc321ff98ee873f9e8b9cc037fd2

diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index da80159..1b2944b 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -152,6 +152,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/control/templateviewitem \
     sfx2/source/control/templatefolderview \
     sfx2/source/control/templatefolderviewitem \
+    sfx2/source/control/templatesearchview \
     sfx2/source/control/thumbnailviewitem \
     sfx2/source/control/thumbnailviewacc \
     sfx2/source/control/thumbnailview \
diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index f729b6e..3698381 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -18,6 +18,8 @@
 class Edit;
 class PopupMenu;
 class TemplateFolderView;
+class TemplateSearchView;
+class ThumbnailView;
 class ThumbnailViewItem;
 class ToolBox;
 
@@ -62,6 +64,8 @@ private:
 
     DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*);
 
+    DECL_LINK(SearchUpdateHdl, Edit*);
+
     void OnTemplateImport ();
     void OnTemplateSearch ();
     void OnTemplateEdit ();
@@ -83,6 +87,7 @@ private:
     ToolBox *mpViewBar;
     ToolBox *mpActionBar;
     ToolBox *mpTemplateBar;
+    TemplateSearchView *mpSearchView;
     TemplateFolderView *maView;
     PopupMenu *mpCreateMenu;
     PopupMenu *mpActionMenu;
diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx
new file mode 100644
index 0000000..dbcf0d1
--- /dev/null
+++ b/sfx2/source/control/templatesearchview.cxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * 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/.
+ */
+
+#include "templatesearchview.hxx"
+
+#include <sfx2/templateviewitem.hxx>
+
+struct TemplateSearchViewItem : public TemplateViewItem
+{
+    TemplateSearchViewItem (ThumbnailView &rView, Window *pParent)
+        : TemplateViewItem(rView,pParent)
+    {}
+
+    virtual ~TemplateSearchViewItem ()
+    {}
+
+    sal_uInt16 mnIdx;       // Template associated Index
+    sal_uInt16 mnRegionId;  // Template associated Region id
+};
+
+TemplateSearchView::TemplateSearchView (Window *pParent, WinBits nWinStyle)
+    : ThumbnailView(pParent,nWinStyle)
+{
+}
+
+TemplateSearchView::~TemplateSearchView ()
+{
+}
+
+void TemplateSearchView::AppendItem(sal_uInt16 nItemId, sal_uInt16 nRegionId, sal_uInt16 nIdx,
+                                    const rtl::OUString &rStr, const rtl::OUString &rPath,
+                                    const BitmapEx &rImage)
+{
+    TemplateSearchViewItem *pItem = new TemplateSearchViewItem(*this,this);
+    pItem->mnId = nItemId;
+    pItem->mnIdx = nIdx;
+    pItem->mnRegionId = nRegionId;
+    pItem->maPreview1 = rImage;
+    pItem->maText = rStr;
+    pItem->setPath(rPath);
+    pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnFolderSelected));
+
+    mItemList.push_back(pItem);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 357c247..018e98d 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -10,6 +10,7 @@
 #include "templatedlg.hxx"
 
 #include "inputdlg.hxx"
+#include "templatesearchview.hxx"
 
 #include <comphelper/processfactory.hxx>
 #include <sfx2/filedlghelper.hxx>
@@ -76,6 +77,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
       mpViewBar( new ToolBox(this, SfxResId(TBX_ACTION_VIEW))),
       mpActionBar( new ToolBox(this, SfxResId(TBX_ACTION_ACTION))),
       mpTemplateBar( new ToolBox(this, SfxResId(TBX_ACTION_TEMPLATES))),
+      mpSearchView(new TemplateSearchView(this)),
       maView(new TemplateFolderView(this,SfxResId(TEMPLATE_VIEW))),
       mnSelectionCount(0),
       mxDesktop(comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.frame.Desktop" ),uno::UNO_QUERY )
@@ -152,6 +154,8 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
 
     mpSearchEdit->SetSizePixel(aSearchSize);
     mpSearchEdit->SetPosPixel(Point(PADDING_DLG_BORDER,aActionPos.Y()+aActionSize.getHeight()));
+    mpSearchEdit->SetUpdateDataHdl(LINK(this,SfxTemplateManagerDlg,SearchUpdateHdl));
+    mpSearchEdit->EnableUpdateData();
 
     maView->SetStyle(WB_VSCROLL);
     maView->SetColor(GetBackground().GetColor());
@@ -507,6 +511,20 @@ IMPL_LINK(SfxTemplateManagerDlg, OpenTemplateHdl, ThumbnailViewItem*, pItem)
     return 0;
 }
 
+IMPL_LINK (SfxTemplateManagerDlg, SearchUpdateHdl, Edit*, pEdit)
+{
+    // if the search view is hidden, hide the folder view and display search one
+    if (!mpSearchView->IsVisible())
+    {
+        mpSearchView->Show();
+        maView->Hide();
+    }
+
+    mpSearchView->Clear();
+
+    return 0;
+}
+
 void SfxTemplateManagerDlg::OnTemplateImport ()
 {
     sal_Int16 nDialogType =
@@ -609,6 +627,14 @@ void SfxTemplateManagerDlg::OnTemplateSearch ()
     SetSizePixel(aWinSize);
     maView->SetPosPixel(aPos);
     maButtonClose.SetPosPixel(aClosePos);
+
+    // Hide search view
+    if (bVisible)
+    {
+        mpSearchView->Hide();
+        maView->Show();
+    }
+
     mpSearchEdit->Show(!bVisible);
 }
 
diff --git a/sfx2/source/inc/templatesearchview.hxx b/sfx2/source/inc/templatesearchview.hxx
new file mode 100644
index 0000000..3d453b3
--- /dev/null
+++ b/sfx2/source/inc/templatesearchview.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * 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/.
+ */
+
+#ifndef __SFX2_TEMPLATESEARCHVIEW_HXX__
+#define __SFX2_TEMPLATESEARCHVIEW_HXX__
+
+#include <sfx2/thumbnailview.hxx>
+
+class TemplateSearchView : public ThumbnailView
+{
+public:
+
+    TemplateSearchView ( Window* pParent, WinBits nWinStyle = WB_TABSTOP | WB_VSCROLL);
+
+    virtual ~TemplateSearchView();
+
+    void AppendItem(sal_uInt16 nItemId, sal_uInt16 nRegionId, sal_uInt16 nIdx,
+                    const rtl::OUString &rStr, const rtl::OUString &rPath,
+                    const BitmapEx &rImage );
+};
+
+#endif // __SFX2_TEMPLATESEARCHVIEW_HXX__
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 89cb69a018568029be04663361ea5813870b3d95
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Tue Jul 3 14:20:19 2012 -0430

    Dont draw folder name while we are editing it.
    
    Change-Id: I9bec6832725b2a5e194968d938de1dac875a59f0

diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx
index 3ecdc9b..8934b58 100644
--- a/sfx2/inc/sfx2/templateview.hxx
+++ b/sfx2/inc/sfx2/templateview.hxx
@@ -56,6 +56,7 @@ protected:
 private:
 
     Image maCloseImg;
+    bool mbRenderTitle;
     sal_uInt16 mnRegionId;
     rtl::OUString maFolderName;
     SfxDocumentTemplates *mpDocTemplates;
diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx
index 5078fbd..d9748f5 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -36,6 +36,7 @@ using namespace drawinglayer::primitive2d;
 TemplateView::TemplateView (Window *pParent, SfxDocumentTemplates *pTemplates)
     : ThumbnailView(pParent,WB_VSCROLL),
       maCloseImg(SfxResId(IMG_TEMPLATE_VIEW_CLOSE)),
+      mbRenderTitle(true),
       mnRegionId(0),
       mpDocTemplates(pTemplates),
       mpEditName(new Edit(this, WB_BORDER | WB_HIDE))
@@ -60,27 +61,36 @@ void TemplateView::Paint (const Rectangle &rRect)
 {
     ThumbnailView::Paint(rRect);
 
-    Primitive2DSequence aSeq(2);
+    int nCount = 0;
+    int nMaxCount = 1;
+
+    if (mbRenderTitle)
+        ++nMaxCount;
+
+    Primitive2DSequence aSeq(nMaxCount);
     TextLayouterDevice aTextDev;
 
     // Draw centered region name
     Point aPos;
     Size aWinSize = GetOutputSizePixel();
 
-    aPos.X() = (aWinSize.getWidth() - aTextDev.getTextWidth(maFolderName,0,maFolderName.getLength()))/2;
-    aPos.Y() = aTextDev.getTextHeight() + (mnHeaderHeight - aTextDev.getTextHeight())/2;
-
-    basegfx::B2DHomMatrix aTextMatrix( createScaleTranslateB2DHomMatrix(
-                mpItemAttrs->aFontSize.getX(), mpItemAttrs->aFontSize.getY(),
-                double( aPos.X() ), double( aPos.Y() ) ) );
-
-    aSeq[0] = Primitive2DReference(
-                new TextSimplePortionPrimitive2D(aTextMatrix,
-                                                 maFolderName,0,maFolderName.getLength(),
-                                                 std::vector< double >( ),
-                                                 mpItemAttrs->aFontAttr,
-                                                 com::sun::star::lang::Locale(),
-                                                 Color(COL_BLACK).getBColor() ) );
+    if (mbRenderTitle)
+    {
+        aPos.X() = (aWinSize.getWidth() - aTextDev.getTextWidth(maFolderName,0,maFolderName.getLength()))/2;
+        aPos.Y() = aTextDev.getTextHeight() + (mnHeaderHeight - aTextDev.getTextHeight())/2;
+
+        basegfx::B2DHomMatrix aTextMatrix( createScaleTranslateB2DHomMatrix(
+                    mpItemAttrs->aFontSize.getX(), mpItemAttrs->aFontSize.getY(),
+                    double( aPos.X() ), double( aPos.Y() ) ) );
+
+        aSeq[nCount++] = Primitive2DReference(
+                    new TextSimplePortionPrimitive2D(aTextMatrix,
+                                                     maFolderName,0,maFolderName.getLength(),
+                                                     std::vector< double >( ),
+                                                     mpItemAttrs->aFontAttr,
+                                                     com::sun::star::lang::Locale(),
+                                                     Color(COL_BLACK).getBColor() ) );
+    }
 
     // Draw close icon
     Size aImageSize = maCloseImg.GetSizePixel();
@@ -88,7 +98,7 @@ void TemplateView::Paint (const Rectangle &rRect)
     aPos.Y() = (mnHeaderHeight - aImageSize.Height())/2;
     aPos.X() = aWinSize.Width() - aImageSize.Width() - aPos.Y();
 
-    aSeq[1] = Primitive2DReference( new FillBitmapPrimitive2D(
+    aSeq[nCount] = Primitive2DReference( new FillBitmapPrimitive2D(
                                         createTranslateB2DHomMatrix(aPos.X(),aPos.Y()),
                                         FillBitmapAttribute(maCloseImg.GetBitmapEx(),
                                                             B2DPoint(0,0),
@@ -161,6 +171,7 @@ void TemplateView::MouseButtonDown (const MouseEvent &rMEvt)
         if (mpEditName->IsVisible())
         {
             mpEditName->Show(false);
+            mbRenderTitle = true;
 
             // Update name if its not empty
             rtl::OUString aTmp = mpEditName->GetText();
@@ -203,7 +214,12 @@ void TemplateView::MouseButtonDown (const MouseEvent &rMEvt)
             Rectangle aTitleRect(aPos,Size(fTextWidth,aTextDev.getTextHeight()));
 
             if (aTitleRect.IsInside(rMEvt.GetPosPixel()))
+            {
+                mbRenderTitle = false;
+
+                Invalidate();
                 mpEditName->Show();
+            }
         }
     }
 
commit 9f55545a1a1d96e133eb734607ef52a463a0f0ea
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Tue Jul 3 14:06:50 2012 -0430

    Create dialog skeleton to ask user for new folder name.
    
    Change-Id: I5f861753c7b4d0e901c8268f4004676df7da124f

diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 0bff14e..da80159 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -164,6 +164,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/dialog/filedlghelper \
     sfx2/source/dialog/filtergrouping \
     sfx2/source/dialog/itemconnect \
+    sfx2/source/dialog/inputdlg \
     sfx2/source/dialog/mailmodel \
     sfx2/source/dialog/mgetempl \
     sfx2/source/dialog/navigat \
diff --git a/sfx2/source/dialog/inputdlg.cxx b/sfx2/source/dialog/inputdlg.cxx
new file mode 100644
index 0000000..41d5d4f
--- /dev/null
+++ b/sfx2/source/dialog/inputdlg.cxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * 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/.
+ */
+
+#include "inputdlg.hxx"
+
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+
+#define LABEL_TEXT_SPACE 10
+#define DIALOG_BORDER 10
+#define MAX_FOLDER_NAME_LENGTH 20
+
+InputDialog::InputDialog (const rtl::OUString &rLabelText, Window *pParent)
+    : ModalDialog(pParent),
+      mpEntry(new Edit(this)),
+      mpLabel(new FixedText(this))
+{
+    SetStyle(GetStyle() | WB_CENTER | WB_VCENTER);
+
+    Point aPos(DIALOG_BORDER,DIALOG_BORDER);
+
+    Size aTextSize = mpLabel->CalcMinimumTextSize(mpLabel,100);
+    Size aEntrySize = mpEntry->CalcSize(MAX_FOLDER_NAME_LENGTH);
+
+    aTextSize.setWidth(aEntrySize.getHeight());
+
+    mpLabel->SetPosPixel(Point(DIALOG_BORDER,DIALOG_BORDER));
+    mpLabel->SetSizePixel(aTextSize);
+    mpLabel->SetText(String("Enter name"));
+
+    aPos.setX(DIALOG_BORDER + aTextSize.getWidth() + LABEL_TEXT_SPACE + DIALOG_BORDER);
+
+    mpEntry->SetPosPixel(aPos);
+    mpEntry->SetSizePixel(aEntrySize);
+
+    // Set windows correct size
+    SetSizePixel(Size(aTextSize.getWidth() + aEntrySize.getWidth() + 2*DIALOG_BORDER,
+                      aTextSize.getHeight()+2*DIALOG_BORDER));
+
+    mpEntry->Show();
+    mpLabel->Show();
+}
+
+rtl::OUString InputDialog::getEntryText () const
+{
+    return mpEntry->GetText();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+
diff --git a/sfx2/source/dialog/inputdlg.hrc b/sfx2/source/dialog/inputdlg.hrc
new file mode 100644
index 0000000..b9fdf70
--- /dev/null
+++ b/sfx2/source/dialog/inputdlg.hrc
@@ -0,0 +1,7 @@
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * 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/.
+ */
diff --git a/sfx2/source/dialog/inputdlg.src b/sfx2/source/dialog/inputdlg.src
new file mode 100644
index 0000000..cece9f8
--- /dev/null
+++ b/sfx2/source/dialog/inputdlg.src
@@ -0,0 +1,10 @@
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * 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/.
+ */
+
+#include "inputdlg.hrc"
+
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 9b819ba..357c247 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -9,6 +9,8 @@
 
 #include "templatedlg.hxx"
 
+#include "inputdlg.hxx"
+
 #include <comphelper/processfactory.hxx>
 #include <sfx2/filedlghelper.hxx>
 #include <sfx2/sfxresid.hxx>
@@ -459,6 +461,9 @@ IMPL_LINK(SfxTemplateManagerDlg, MoveMenuSelectHdl, Menu*, pMenu)
 
     if (nMenuId == MNI_MOVE_NEW)
     {
+        InputDialog dlg(SfxResId(STR_INPUT_NEW).toString(),this);
+
+        int ret = dlg.Execute();
     }
     else if (nMenuId == MNI_MOVE_DELETE)
     {
diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc
index b24d844..8a46b11 100644
--- a/sfx2/source/doc/templatedlg.hrc
+++ b/sfx2/source/doc/templatedlg.hrc
@@ -51,6 +51,7 @@
 
 #define STR_MOVE_NEW                268
 #define STR_MOVE_DELETE             270
+#define STR_INPUT_NEW               271
 
 #define IMG_ONLINE_REPOSITORY       100
 #define IMG_CREATE_TEXT             300
diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src
index 27fdfbb..f0ac332 100644
--- a/sfx2/source/doc/templatedlg.src
+++ b/sfx2/source/doc/templatedlg.src
@@ -45,6 +45,11 @@ String STR_MOVE_DELETE
     Text [ en-US ] = "No folder";
 };
 
+String STR_INPUT_NEW
+{
+    Text [ en-US ] = "Enter folder name:";
+};
+
 ModalDialog DLG_TEMPLATE_MANAGER
 {
     HelpId = CMD_SID_TEMPLATE_MANAGER;
diff --git a/sfx2/source/inc/inputdlg.hxx b/sfx2/source/inc/inputdlg.hxx
new file mode 100644
index 0000000..7e09c9f
--- /dev/null
+++ b/sfx2/source/inc/inputdlg.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * 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/.
+ */
+
+#ifndef INPUTDLG_HXX
+#define INPUTDLG_HXX
+
+#include <vcl/dialog.hxx>
+
+class Edit;
+class FixedText;
+class PushButton;
+
+class InputDialog : public ModalDialog
+{
+public:
+
+    InputDialog (const rtl::OUString &labelText, Window *pParent = NULL);
+
+    rtl::OUString getEntryText () const;
+
+private:
+
+    Edit *mpEntry;
+    FixedText *mpLabel;
+    PushButton *mpOK;
+    PushButton *mpCancel;
+};
+
+#endif // INPUTDLG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit ff1ba1fc3c45b7449e2f4fe3c46a1d4c134a7092
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Mon Jul 2 23:13:12 2012 -0430

    Move close button down while search is active.
    
    Change-Id: I42eed0d99b6eae6510c62fda76492e8114624459

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 2483dcb..9b819ba 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -581,6 +581,7 @@ void SfxTemplateManagerDlg::OnTemplateImport ()
 void SfxTemplateManagerDlg::OnTemplateSearch ()
 {
     Point aPos = maView->GetPosPixel();
+    Point aClosePos = maButtonClose.GetPosPixel();
     bool bVisible = mpSearchEdit->IsVisible();
     Size aWinSize = GetSizePixel();
     long nEditHeight = mpSearchEdit->GetSizePixel().getHeight();
@@ -589,17 +590,20 @@ void SfxTemplateManagerDlg::OnTemplateSearch ()
     {
         aWinSize.setHeight(aWinSize.getHeight() - nEditHeight );
         aPos.setY(aPos.getY() - nEditHeight );
+        aClosePos.setY(aClosePos.getY() - nEditHeight );
         mpActionBar->SetItemState(TBI_TEMPLATE_SEARCH,STATE_NOCHECK);
     }
     else
     {
         aWinSize.setHeight(aWinSize.getHeight() + nEditHeight );
         aPos.setY(aPos.getY() + nEditHeight );
+        aClosePos.setY(aClosePos.getY() + nEditHeight );
         mpActionBar->SetItemState(TBI_TEMPLATE_SEARCH,STATE_CHECK);
     }
 
     SetSizePixel(aWinSize);
     maView->SetPosPixel(aPos);
+    maButtonClose.SetPosPixel(aClosePos);
     mpSearchEdit->Show(!bVisible);
 }
 
commit 007ad58e5108431b01db5e2aa93fd21b6ca508f2
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Mon Jul 2 22:59:53 2012 -0430

    Add icons to toolbar buttons and menus.
    
    Change-Id: Ia1415d3cab1f381a7b84ad3cabeacefe739a047c

diff --git a/icon-themes/galaxy/sfx2/res/create_draw.png b/icon-themes/galaxy/sfx2/res/create_draw.png
new file mode 100644
index 0000000..f99e503
Binary files /dev/null and b/icon-themes/galaxy/sfx2/res/create_draw.png differ
diff --git a/icon-themes/galaxy/sfx2/res/create_present.png b/icon-themes/galaxy/sfx2/res/create_present.png
new file mode 100644
index 0000000..f3e7e26
Binary files /dev/null and b/icon-themes/galaxy/sfx2/res/create_present.png differ
diff --git a/icon-themes/galaxy/sfx2/res/create_sheet.png b/icon-themes/galaxy/sfx2/res/create_sheet.png
new file mode 100644
index 0000000..e317659
Binary files /dev/null and b/icon-themes/galaxy/sfx2/res/create_sheet.png differ
diff --git a/icon-themes/galaxy/sfx2/res/create_text.png b/icon-themes/galaxy/sfx2/res/create_text.png
new file mode 100644
index 0000000..35bc877
Binary files /dev/null and b/icon-themes/galaxy/sfx2/res/create_text.png differ
diff --git a/icon-themes/galaxy/sfx2/res/exec_action.png b/icon-themes/galaxy/sfx2/res/exec_action.png
new file mode 100644
index 0000000..e57abd7
Binary files /dev/null and b/icon-themes/galaxy/sfx2/res/exec_action.png differ
diff --git a/icon-themes/galaxy/sfx2/res/import.png b/icon-themes/galaxy/sfx2/res/import.png
new file mode 100644
index 0000000..37f6406
Binary files /dev/null and b/icon-themes/galaxy/sfx2/res/import.png differ
diff --git a/icon-themes/galaxy/sfx2/res/search.png b/icon-themes/galaxy/sfx2/res/search.png
new file mode 100644
index 0000000..228d958
Binary files /dev/null and b/icon-themes/galaxy/sfx2/res/search.png differ
diff --git a/icon-themes/galaxy/sfx2/res/sortascending.png b/icon-themes/galaxy/sfx2/res/sortascending.png
new file mode 100644
index 0000000..3d710f9
Binary files /dev/null and b/icon-themes/galaxy/sfx2/res/sortascending.png differ
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 4a8322e..2483dcb 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -82,14 +82,14 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
 
     // Create popup menus
     mpCreateMenu = new PopupMenu;
-    mpCreateMenu->InsertItem(MNI_CREATE_TEXT,SfxResId(STR_CREATE_TEXT).toString());
-    mpCreateMenu->InsertItem(MNI_CREATE_SHEET,SfxResId(STR_CREATE_SHEET).toString());
-    mpCreateMenu->InsertItem(MNI_CREATE_PRESENT,SfxResId(STR_CREATE_PRESENT).toString());
-    mpCreateMenu->InsertItem(MNI_CREATE_DRAW,SfxResId(STR_CREATE_DRAW).toString());
+    mpCreateMenu->InsertItem(MNI_CREATE_TEXT,SfxResId(STR_CREATE_TEXT).toString(),SfxResId(IMG_CREATE_TEXT));
+    mpCreateMenu->InsertItem(MNI_CREATE_SHEET,SfxResId(STR_CREATE_SHEET).toString(),SfxResId(IMG_CREATE_SHEET));
+    mpCreateMenu->InsertItem(MNI_CREATE_PRESENT,SfxResId(STR_CREATE_PRESENT).toString(),SfxResId(IMG_CREATE_PRESENT));
+    mpCreateMenu->InsertItem(MNI_CREATE_DRAW,SfxResId(STR_CREATE_DRAW).toString(),SfxResId(IMG_CREATE_DRAW));
     mpCreateMenu->SetSelectHdl(LINK(this, SfxTemplateManagerDlg, MenuSelectHdl));
 
     mpActionMenu = new PopupMenu;
-    mpActionMenu->InsertItem(MNI_ACTION_SORT_NAME,SfxResId(STR_ACTION_SORT_NAME).toString());
+    mpActionMenu->InsertItem(MNI_ACTION_SORT_NAME,SfxResId(STR_ACTION_SORT_NAME).toString(),SfxResId(IMG_ACTION_SORT));
     mpActionMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,MenuSelectHdl));
 
     Size aWinSize = GetOutputSize();
diff --git a/sfx2/source/doc/templatedlg.hrc b/sfx2/source/doc/templatedlg.hrc
index 245466f..b24d844 100644
--- a/sfx2/source/doc/templatedlg.hrc
+++ b/sfx2/source/doc/templatedlg.hrc
@@ -53,3 +53,8 @@
 #define STR_MOVE_DELETE             270
 
 #define IMG_ONLINE_REPOSITORY       100
+#define IMG_CREATE_TEXT             300
+#define IMG_CREATE_SHEET            301
+#define IMG_CREATE_PRESENT          302
+#define IMG_CREATE_DRAW             303
+#define IMG_ACTION_SORT             304
diff --git a/sfx2/source/doc/templatedlg.src b/sfx2/source/doc/templatedlg.src
index f4b6962..27fdfbb 100644
--- a/sfx2/source/doc/templatedlg.src
+++ b/sfx2/source/doc/templatedlg.src
@@ -129,10 +129,51 @@ ModalDialog DLG_TEMPLATE_MANAGER
     {
         ImageBitmap = Bitmap
         {
-            File = "signet.png";
+            File = "ln053.png";
         };
     };
 
+    Image IMG_CREATE_TEXT
+    {
+        ImageBitmap = Bitmap
+        {
+            File = "create_text.png";
+        };
+    };
+
+    Image IMG_CREATE_SHEET
+    {
+        ImageBitmap = Bitmap
+        {
+            File = "create_sheet.png";
+        };
+    };
+
+    Image IMG_CREATE_PRESENT
+    {
+        ImageBitmap = Bitmap
+        {
+            File = "create_present.png";
+        };
+    };
+
+    Image IMG_CREATE_DRAW
+    {
+        ImageBitmap = Bitmap
+        {
+            File = "create_draw.png";
+        };
+    };
+
+    Image IMG_ACTION_SORT
+    {
+        ImageBitmap = Bitmap
+        {
+            File = "sortascending.png";
+        };
+    };
+
+
     ToolBox TBX_ACTION_VIEW
     {
         SVLook = TRUE ;
@@ -145,12 +186,22 @@ ModalDialog DLG_TEMPLATE_MANAGER
             {
                 Identifier = TBI_TEMPLATE_CREATE;
                 Text [ en-US ] = "Create a template" ;
+
+                ItemImage = Image
+                {
+                    ImageBitmap = Bitmap { File = "create_text.png" ; };
+                };
             };
 
             ToolBoxItem
             {
                 Identifier = TBI_TEMPLATE_IMPORT ;
                 Text [ en-US ] = "Import a template" ;
+
+                ItemImage = Image
+                {
+                    ImageBitmap = Bitmap { File = "import.png" ; };
+                };
             };
         };
     };
@@ -167,12 +218,22 @@ ModalDialog DLG_TEMPLATE_MANAGER
             {
                 Identifier = TBI_TEMPLATE_SEARCH;
                 Text [en-US] = "Search";
+
+                ItemImage = Image
+                {
+                    ImageBitmap = Bitmap { File = "search.png" ; };
+                };
             };
 
             ToolBoxItem
             {
                 Identifier = TBI_TEMPLATE_ACTION;
                 Text [en-US] = "Action Menu";
+
+                ItemImage = Image
+                {
+                    ImageBitmap = Bitmap { File = "exec_action.png" ; };
+                };
             };
         };
     };
commit 93a378e081d7311ee43ea4f8f283eed38814ca0e
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Mon Jul 2 21:41:37 2012 -0430

    Disable importing a template while a folder isnt selected.
    
    Change-Id: I3428205cafe41784ee8df24f8511511eebca81c2

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 4488bc9..4a8322e 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -122,6 +122,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
     mpTemplateBar->SetButtonType(BUTTON_SYMBOLTEXT);
 
     // Set toolbox button bits
+    mpViewBar->EnableItem(TBI_TEMPLATE_IMPORT,false);
     mpViewBar->SetItemBits(TBI_TEMPLATE_CREATE, TIB_DROPDOWNONLY);
     mpActionBar->SetItemBits(TBI_TEMPLATE_ACTION, TIB_DROPDOWNONLY);
     mpTemplateBar->SetItemBits(TBI_TEMPLATE_MOVE,TIB_DROPDOWNONLY);
@@ -370,11 +371,17 @@ IMPL_LINK(SfxTemplateManagerDlg, TVFolderStateHdl, const ThumbnailViewItem*, pIt
 {
     if (pItem->isSelected())
     {
+        if (maSelFolders.empty())
+            mpViewBar->EnableItem(TBI_TEMPLATE_IMPORT,true);
+
         maSelFolders.insert(pItem);
     }
     else
     {
         maSelFolders.erase(pItem);
+
+        if (maSelFolders.empty())
+            mpViewBar->EnableItem(TBI_TEMPLATE_IMPORT,false);
     }
 
     return 0;
commit 71d8a8de222b160cc0a3a1a3eaa2a8c4da34e5b6
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Tue Jul 3 20:24:18 2012 +0200

    templates dlg: close window and use _default target for template creation
    
    Change-Id: Icc9d7acca1669620b53bdc634a3d188323ee9440

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 60e68a6..4488bc9 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -419,15 +419,19 @@ IMPL_LINK(SfxTemplateManagerDlg, MenuSelectHdl, Menu*, pMenu)
     {
     case MNI_CREATE_TEXT:
         lcl_createTemplate(mxDesktop,FILTER_APP_WRITER);
+        Close( );
         break;
     case MNI_CREATE_SHEET:
         lcl_createTemplate(mxDesktop,FILTER_APP_CALC);
+        Close( );
         break;
     case MNI_CREATE_PRESENT:
         lcl_createTemplate(mxDesktop,FILTER_APP_IMPRESS);
+        Close( );
         break;
     case MNI_CREATE_DRAW:
         lcl_createTemplate(mxDesktop,FILTER_APP_DRAW);
+        Close( );
         break;
     case MNI_ACTION_SORT_NAME:
         if (maView->isOverlayVisible())
@@ -662,7 +666,7 @@ void lcl_createTemplate(uno::Reference< com::sun::star::frame::XComponentLoader
     if (!aURL.isEmpty())
     {
         uno::Sequence<PropertyValue> aArgs;
-        xDesktop->loadComponentFromURL(aURL,rtl::OUString("_blank"), 0, aArgs );
+        xDesktop->loadComponentFromURL(aURL,rtl::OUString("_default"), 0, aArgs );
     }
 }
 
commit 9c47fae01bac6374c24cb8e3653becbfc773e0e7
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Tue Jul 3 14:54:18 2012 +0200

    Template dialog: show the menu entry when enabling experimental features
    
    Change-Id: Idfd57169d40e9bb60d72559f3ca09f7d34cf60df

diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi
index 11d7e3a..0d7c7a0 100644
--- a/sfx2/sdi/appslots.sdi
+++ b/sfx2/sdi/appslots.sdi
@@ -130,6 +130,7 @@ interface Application
     SID_TEMPLATE_MANAGER // ole(no) api(final/play/rec)
     [
         ExecMethod = MiscExec_Impl ;
+        StateMethod = MiscState_Impl ;
     ]
     SID_ORGANIZER // ole(no) api(final/play/rec)
     [
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index ad6012f..5e83a9f 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -53,6 +53,7 @@
 #include "comphelper/configurationhelper.hxx"
 
 #include <svtools/addresstemplate.hxx>
+#include <svtools/miscopt.hxx>
 #include <svl/visitem.hxx>
 #include <unotools/intlwrapper.hxx>
 
@@ -778,6 +779,17 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
                         rSet.DisableItem(SID_SHOW_IME_STATUS_WINDOW);
                     break;
 
+                case SID_TEMPLATE_MANAGER:
+                    {
+                        SvtMiscOptions aMiscOptions;
+                        if ( !aMiscOptions.IsExperimentalMode() )
+                        {
+                           rSet.DisableItem( nWhich );
+                           rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
+                        }
+                    }
+                    break;
+
                 default:
                     break;
             }
commit b12ad0815468d9f12517da8c12a53c6f3687d8cc
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Mon Jul 2 21:17:15 2012 -0430

    Disable drawing folder items while overlay is active.
    
    Change-Id: Iab2d1a5a4b18f981f996f592f66ed52acb04ac73

diff --git a/sfx2/inc/sfx2/templatefolderview.hxx b/sfx2/inc/sfx2/templatefolderview.hxx
index 2f604d9..b1dcade 100644
--- a/sfx2/inc/sfx2/templatefolderview.hxx
+++ b/sfx2/inc/sfx2/templatefolderview.hxx
@@ -72,6 +72,8 @@ private:
 
     DECL_LINK(ChangeNameHdl, TemplateView*);
 
+    DECL_LINK(OverlayCloseHdl, void*);
+
 private:
 
     bool mbFilteredResults;     // Flag keep track if overlay has been filtered so folders can get filtered too afterwards
diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx
index ba9baa0..3ecdc9b 100644
--- a/sfx2/inc/sfx2/templateview.hxx
+++ b/sfx2/inc/sfx2/templateview.hxx
@@ -41,6 +41,8 @@ public:
 
     void setChangeNameHdl (const Link &rLink) { maChangeNameHdl = rLink; }
 
+    void setCloseHdl (const Link &rLink) { maCloseHdl = rLink; }
+
 protected:
 
     virtual void Resize ();
@@ -59,6 +61,7 @@ private:
     SfxDocumentTemplates *mpDocTemplates;
     Link maDblClickHdl;
     Link maChangeNameHdl;
+    Link maCloseHdl;
 
     Edit *mpEditName;
 };
diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx
index 1145af5..84ff537 100644
--- a/sfx2/inc/sfx2/thumbnailview.hxx
+++ b/sfx2/inc/sfx2/thumbnailview.hxx
@@ -346,6 +346,7 @@ protected:
     bool mbIsTransientChildrenDisabled : 1;
     bool mbHasVisibleItems : 1;
     bool mbSelectionMode;
+    bool mbActive;
     Color maColor;
 
     Link maItemStateHdl;
diff --git a/sfx2/source/control/templatefolderview.cxx b/sfx2/source/control/templatefolderview.cxx
index e2fc4ba..e8b01f5 100644
--- a/sfx2/source/control/templatefolderview.cxx
+++ b/sfx2/source/control/templatefolderview.cxx
@@ -262,6 +262,7 @@ TemplateFolderView::TemplateFolderView ( Window* pParent, const ResId& rResId, b
 
     mpItemView->setItemStateHdl(LINK(this,TemplateFolderView,TVTemplateStateHdl));
     mpItemView->setChangeNameHdl(LINK(this,TemplateFolderView,ChangeNameHdl));
+    mpItemView->setCloseHdl(LINK(this,TemplateFolderView,OverlayCloseHdl));
 }
 
 TemplateFolderView::~TemplateFolderView()
@@ -352,6 +353,7 @@ bool TemplateFolderView::isOverlayVisible () const
 
 void TemplateFolderView::showOverlay (bool bVisible)
 {
+    mbActive = !bVisible;
     mpItemView->Show(bVisible);
 
     // Clear items is the overlay is closed.
@@ -568,6 +570,7 @@ void TemplateFolderView::OnItemDblClicked (ThumbnailViewItem *pRegionItem)
     if (meFilterOption != FILTER_APP_NONE)
         mpItemView->filterItems(ViewFilter_Application(mpDocTemplates,meFilterOption));
 
+    mbActive = false;
     mpItemView->Show();
 }
 
@@ -599,4 +602,10 @@ IMPL_LINK(TemplateFolderView, ChangeNameHdl, TemplateView*, pView)
     return true;
 }
 
+IMPL_LINK_NOARG(TemplateFolderView, OverlayCloseHdl)
+{
+    showOverlay(false);
+    return 0;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx
index c757356..5078fbd 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -189,8 +189,7 @@ void TemplateView::MouseButtonDown (const MouseEvent &rMEvt)
 
         if (aImgRect.IsInside(rMEvt.GetPosPixel()))
         {
-            Show(false);
-            Clear();
+            maCloseHdl.Call(this);
         }
         else
         {
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 7e0ec57..92938eb 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -104,6 +104,7 @@ void ThumbnailView::ImplInit()
     mbScroll            = false;
     mbHasVisibleItems   = false;
     mbSelectionMode = false;
+    mbActive = true;
     maFilterFunc = ViewFilterAll();
 
     // Create the processor and process the primitives
@@ -195,7 +196,7 @@ void ThumbnailView::ImplInitScrollBar()
 
 void ThumbnailView::DrawItem (ThumbnailViewItem *pItem)
 {
-    if (pItem->isVisible())
+    if (mbActive && pItem->isVisible())
     {
         Rectangle aRect = pItem->getDrawArea();
 
@@ -600,7 +601,7 @@ void ThumbnailView::MouseMove( const MouseEvent& rMEvt )
 {
     ThumbnailViewItem* pItem = ImplGetItem( ImplGetItem( rMEvt.GetPosPixel() ) );
 
-    if (pItem)
+    if (pItem && mbActive)
     {
         if (mnHighItemId != pItem->mnId && pItem->isVisible())
         {
commit 3ffa63c3bdef67447abdc8ccb7b9bc0a3ec58b3e
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Mon Jul 2 17:49:04 2012 -0430

    Make folder view scrollable.
    
    Change-Id: Id93cee3c115086b6d96203b6c2bb7d319ab23234

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index e35542b..60e68a6 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -150,7 +150,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
     mpSearchEdit->SetSizePixel(aSearchSize);
     mpSearchEdit->SetPosPixel(Point(PADDING_DLG_BORDER,aActionPos.Y()+aActionSize.getHeight()));
 
-    maView->SetStyle(WB_TABSTOP);
+    maView->SetStyle(WB_VSCROLL);
     maView->SetColor(GetBackground().GetColor());
     maView->SetSizePixel(aThumbSize);
     maView->setItemMaxTextLength(ITEM_MAX_TEXT_LENGTH);
commit 90256a112507998b89af8eecb678e6e12c5dfbd1
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Mon Jul 2 16:56:25 2012 -0430

    Change order of "New folder" entry in move menu.
    
    Change-Id: Icb12d893514b1f1505d6ff84aeaa6bbcef136eec

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 12ddd1c..e35542b 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -338,18 +338,15 @@ IMPL_LINK(SfxTemplateManagerDlg, TBXDropdownHdl, ToolBox*, pBox)
         PopupMenu *pMoveMenu = new PopupMenu;
         pMoveMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,MoveMenuSelectHdl));
 
-        pMoveMenu->InsertItem(MNI_MOVE_NEW,SfxResId(STR_MOVE_NEW).toString());
-
         if (!aNames.empty())
         {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list