CN107025210B - Document tag display method and device for WPS - Google Patents

Document tag display method and device for WPS Download PDF

Info

Publication number
CN107025210B
CN107025210B CN201610074175.6A CN201610074175A CN107025210B CN 107025210 B CN107025210 B CN 107025210B CN 201610074175 A CN201610074175 A CN 201610074175A CN 107025210 B CN107025210 B CN 107025210B
Authority
CN
China
Prior art keywords
document
width
tag
opened
column
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610074175.6A
Other languages
Chinese (zh)
Other versions
CN107025210A (en
Inventor
王芳
陈鹏
邵高扬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd, Guangzhou Kingsoft Mobile Technology Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN201610074175.6A priority Critical patent/CN107025210B/en
Publication of CN107025210A publication Critical patent/CN107025210A/en
Application granted granted Critical
Publication of CN107025210B publication Critical patent/CN107025210B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/117Tagging; Marking up; Designating a block; Setting of attributes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Document Processing Apparatus (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the invention provides a document tag display method and device for WPS (Wireless personal storage System), wherein the method comprises the following steps: when receiving an operation of opening any document input by a user, determining a first width of a document tag of the document to be opened according to the name of the document to be opened; calculating a first remaining width of the document label bar according to the second width of the displayed document label and the total width of the document label bar; judging whether the first width is larger than the first residual width; if so, compressing the displayed document tags and/or the document tags of the document to be opened, and displaying the document tags of the document to be opened in the document tag column; if not, displaying the document tag of the document to be opened in the document tag column based on the first width. The embodiment of the invention can correspondingly display each document label according to the width of each document label, and improve the document switching efficiency when switching the document.

Description

Document tag display method and device for WPS
Technical Field
The invention relates to the technical field of computers, in particular to a document tag display method and device for WPS.
Background
WPS (Word Processing System) is a common office software, and can realize various functions such as most common characters, tables, and presentations.
In WPS, a user can open a plurality of documents at the same time for operation, and document tags of the plurality of opened documents can be displayed at the tag bar at the same time. When the user switches among a plurality of opened documents, the user can select a current document to be displayed by searching the document name of each document displayed in the document tab column and clicking the document tab.
In the conventional document tag display method, when the number of opened documents is small and the document tag column is not full, the document tags of the documents can be displayed in the document tag column in a fixed width. When the number of open documents is large and the document tab column is full, in order to display the document tabs of all the open documents on the document tab column, the document tabs of each document need to be compressed so that the document tabs of all the open documents are displayed on the document tab column.
However, in the conventional document tag compression method, the document tags of each document are compressed by using the same compression ratio. However, because the length of the document name of each document is different, when the document tag of a document with a shorter document name is compressed, the complete document name of the document may still be seen in the document tag column; for documents with longer document names, when the document tags of the documents are compressed, the complete document names may not be visible in the document tag column. When a user switches documents by the document names of the documents in the document label column, the user needs to search the documents in sequence because the user cannot see the complete names of all the documents, and the switching efficiency is low.
Disclosure of Invention
The embodiment of the invention aims to provide a document tag display method and device for WPS (WPS), so that each document tag can be correspondingly displayed according to the width of each document tag, and the document switching efficiency is improved when the document is switched. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a document tag display method for a text editing system WPS, which is applied to an electronic device, and the method includes:
when receiving an operation of opening any document input by a user, determining a first width of a document tag of the document to be opened according to the name of the document to be opened;
obtaining a second width of a displayed document label in a document label column and a total width of the document label column, and calculating a first remaining width of the document label column according to the second width of the displayed document label and the total width of the document label column;
judging whether the first width of the document label of the document to be opened is larger than the first residual width;
if so, compressing the displayed document tags and/or the document tags of the document to be opened, and displaying the document tags of the document to be opened in the document tag column;
if not, displaying the document tag of the document to be opened in the document tag column based on the first width.
Further, the displaying the document tab of the document to be opened in the document tab bar based on the first width includes:
judging whether the first width is larger than a preset default width or not;
if yes, judging whether the first width is larger than a preset maximum width; if yes, compressing the width of the document tag of the document to be opened to the maximum width and displaying the width in the document tag column; if not, displaying the document tag of the document to be opened in the document tag column with the first width;
if not, judging whether the first residual width is larger than the default width or not; if so, displaying the document tag of the document to be opened in the document tag column with the default width; and if not, displaying the document tag of the document to be opened in the document tag column with the first width.
Further, the compressing the displayed document tags and/or the document tags of the document to be opened and displaying the document tags of the document to be opened in the document tag column includes:
obtaining each first document label of which the width of the displayed document label is smaller than the preset default width in a document label column, and calculating the actual width corresponding to each first document label according to the name of each first document label;
for each first document tag, adjusting the width of the document tag to be the corresponding actual width;
obtaining a third width of a displayed document label in a current document label column according to the adjusted width of the displayed document label, and calculating a second remaining width of the document label column according to the third width of the displayed document label and the total width of the document label column;
judging whether the first width of the document label of the document to be opened is larger than the second remaining width;
if yes, compressing the displayed document tags and the document tags of the document to be opened, and displaying the document tags of the document to be opened in the document tag column;
if not, displaying the document tag of the document to be opened in the document tag column based on the first width.
Further, the compressing each displayed document tag and the document tag of the document to be opened, and displaying the document tag of the document to be opened in the document tag column includes:
deleting suffixes displayed in the displayed document tags and the document tags of the documents to be opened, and calculating a target width corresponding to the document tags of the documents to be opened after the suffixes are deleted and a fourth width of each displayed document tag;
calculating a third remaining width of the document tab bar according to the fourth width of each displayed document tab and the total width of the document tab bar;
judging whether the target width of the document label of the document to be opened is larger than the third remaining width;
if so, compressing the content of each displayed document tag and the content of the document tag of the document to be opened, and displaying the compressed document tag of the document to be opened in the document tag column;
if not, displaying the document label of the document to be opened in the document label column with the target width.
Further, the compressing the content of each displayed document tag and the content of the document tag of the document to be opened includes:
calculating a compression ratio for compressing the content of the document tag of each document according to the total number of the displayed document tags in the current document tag column, the total width of the document tag column and the third residual width;
and compressing the content of each displayed document tag and the content of the document tag of the document to be opened according to the compression ratio.
Further, the calculating, according to the total number of the displayed document tags in the current document tag column, the total width of the document tag column, and the third remaining width, a compression ratio for compressing the content of the document tag of each document includes:
calculating the compression ratio X according to the following formula:
Figure BDA0000920593070000041
wherein N is the third remaining width; the n is the total number of the displayed document tags in the current document tag column; and L is the total width of the document label bar.
Further, after compressing the content of each displayed document tag and the content of the document tag of the document to be opened, the method further includes:
judging whether a document tag with the width smaller than a preset minimum width exists; if so, the document tag of the at least one document that was opened earliest is hidden.
Further, the displaying the document tab of the document to be opened in the document tab bar based on the first width includes:
and displaying the document tag of the document to be opened in the document tag column with the first width.
In a second aspect, an embodiment of the present invention provides a document tag display apparatus for a text editing system WPS, which is applied to an electronic device, and the apparatus includes:
the determining module is used for determining the first width of a document tag of a document to be opened according to the name of the document to be opened when receiving an operation of opening any document input by a user;
the calculation module is used for obtaining the second width of the displayed document label in the document label column and the total width of the document label column, and calculating the first residual width of the document label column according to the second width of the displayed document label and the total width of the document label column;
the judging module is used for judging whether the first width of the document label of the document to be opened is larger than the first residual width;
the first execution module is used for compressing each displayed document tag and/or document tag of the document to be opened and displaying the document tag of the document to be opened in the document tag column when the judgment result of the judgment module is yes;
and the second execution module is used for displaying the document tag of the document to be opened in the document tag column based on the first width when the judgment result of the judgment module is negative.
Further, the second execution module includes:
the first judgment submodule is used for judging whether the first width is larger than a preset default width or not;
the first display submodule is used for judging whether the first width is larger than the preset maximum width or not when the judgment result of the first judgment submodule is yes; if yes, compressing the width of the document tag of the document to be opened to the maximum width and displaying the width in the document tag column; if not, displaying the document tag of the document to be opened in the document tag column with the first width;
the second display submodule is used for judging whether the first residual width is larger than the default width or not when the judgment result of the first judgment submodule is negative; if so, displaying the document tag of the document to be opened in the document tag column with the default width; and if not, displaying the document tag of the document to be opened in the document tag column with the first width.
Further, the first execution module includes:
the obtaining submodule is used for obtaining each first document tag of which the width of the displayed document tag is smaller than the preset default width in the document tag column and calculating the actual width corresponding to each first document tag according to the name of each first document tag;
the adjusting submodule is used for adjusting the width of each first document tag to be the corresponding actual width;
the calculation submodule is used for obtaining the third width of the displayed document label in the current document label column according to the adjusted width of the displayed document label, and calculating the second residual width of the document label column according to the third width of the displayed document label and the total width of the document label column;
the second judgment submodule is used for judging whether the first width of the document tag of the document to be opened is larger than the second remaining width;
a third display sub-module, configured to, when the determination result of the second determination sub-module is yes, compress each displayed document tag and the document tag of the document to be opened, and display the document tag of the document to be opened in the document tag column;
and the fourth display sub-module is used for displaying the document tag of the document to be opened in the document tag column based on the first width when the judgment result of the second judgment sub-module is negative.
Further, the third display sub-module includes:
a deleting unit, configured to delete suffixes displayed in the displayed document tags and the document tag of the to-be-opened document, and calculate a target width corresponding to the document tag of the to-be-opened document after the suffix is deleted and a fourth width of each displayed document tag;
a calculating unit, configured to calculate a third remaining width of the document tab column according to a fourth width of each displayed document tab and a total width of the document tab column;
the judging unit is used for judging whether the target width of the document label of the document to be opened is larger than the third remaining width;
the compression unit is used for compressing the content of each displayed document tag and the content of the document tag of the document to be opened and displaying the compressed document tag of the document to be opened in the document tag column when the judgment result of the judgment unit is yes;
and the display unit is used for displaying the document label of the document to be opened in the document label column in the target width when the judgment result of the judgment unit is negative.
Further, the compression unit includes:
a calculating subunit, configured to calculate, according to the total number of displayed document tags in the current document tag column, the total width of the document tag column, and the third remaining width, a compression ratio for compressing the content of the document tag of each document;
and the compression subunit is used for compressing the content of each displayed document tag and the content of the document tag of the document to be opened according to the compression ratio.
Further, the computing subunit is specifically configured to:
calculating the compression ratio X according to the following formula:
Figure BDA0000920593070000061
wherein N is the third remaining width; the n is the total number of the displayed document tags in the current document tag column; and L is the total width of the document label bar.
Further, the compressing unit is further configured to compress the content of each displayed document tag and the content of the document tag of the document to be opened, and then determine whether a document tag having a width smaller than a predetermined minimum width exists; if so, the document tag of the at least one document that was opened earliest is hidden.
Further, the second execution module is specifically configured to:
and displaying the document tag of the document to be opened in the document tag column with the first width.
The embodiment of the invention provides a document tag display method and device for WPS (Wireless personal Phone System), which are applied to electronic equipment and comprise the following steps: when receiving an operation of opening any document input by a user, determining a first width of a document tag of the document to be opened according to the name of the document to be opened; obtaining a second width of a displayed document label in a document label column and a total width of the document label column, and calculating a first remaining width of the document label column according to the second width of the displayed document label and the total width of the document label column; judging whether the first width of the document label of the document to be opened is larger than the first residual width; if so, compressing the displayed document tags and/or the document tags of the document to be opened, and displaying the document tags of the document to be opened in the document tag column. If not, displaying the document tag of the document to be opened in the document tag column based on the first width. The embodiment of the invention can correspondingly display each document label according to the width of each document label, but not display all document labels with the same width, thereby enabling a user to see the name of each document and improving the document switching efficiency when switching the documents.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a document tag display method for WPS according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating the display effect of each document tag when the document tag column is not full;
FIGS. 3(a) -3(c) are schematic diagrams illustrating a process of compressing each document tag shown in FIG. 2;
fig. 4 is a schematic structural diagram of a document tag display apparatus for a WPS according to an embodiment of the present invention.
Detailed Description
In order to improve the document switching efficiency, the embodiment of the invention provides a document tag display method and device for WPS.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict. The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to improve the document switching efficiency, an embodiment of the present invention provides a document tag display method process for WPS, as shown in fig. 1, the process includes the following steps:
s101, when receiving an operation of opening any document input by a user, determining a first width of a document tag of the document to be opened according to the name of the document to be opened.
The method may be applied to an electronic device, which may be, for example: notebook computers, desktop computers, portable computers, and the like.
In WPS, a user can open a plurality of documents at the same time for operation, and document tags of the plurality of opened documents can be displayed at the tag bar at the same time.
In the embodiment of the invention, in order to display the name of each document in the document tag of each document, so that when a user switches documents, the document to which the user wants to switch can be selected according to the document name displayed in the document tag of each document, and the document switching efficiency is improved.
For example, when the user inputs an operation of opening a document with respect to the document (e.g., double-clicking the document with a left mouse button), the electronic device may detect the operation input by the user and indicate that the user wants to open the document, at this time, the electronic device may obtain the name of the document to be opened, and determine the first width of the document tag of the document to be opened according to the name of the document to be opened, for example, according to the number of characters included in the name of the document to be opened.
It should be noted that, since documents to be opened may be of different types, and when document tags of the respective types of documents are displayed, suffixes of the display are determined. Therefore, when determining the first width of the document tag of the document to be opened, the electronic device may first determine the type of the document to be opened, and may determine the first width of the document tag of the document to be opened according to the known width of the suffix of the document to be opened and the name of the document to be opened.
It can be understood that the first width of the document tag of the document to be opened is the width of the document tag of the document to be opened when the complete name of the document to be opened can be displayed and there is no empty position under the conditions of normal character size, character spacing and the like.
It should be noted that, in the embodiment of the present invention, a first width of a document tag of a document to be opened may be represented by a pixel, and other widths referred to in the present invention, where a unit of the pixel may be px.
S102, obtaining a second width of a displayed document label in a document label column and a total width of the document label column, and calculating a first remaining width of the document label column according to the second width of the displayed document label and the total width of the document label column.
In the WPS, when a plurality of documents are opened at the same time, document tags of the opened documents are simultaneously displayed in the document tag column. Therefore, in the embodiment of the present invention, when a document tab of a document to be opened is to be displayed, the electronic device may first determine whether other document tabs are already displayed in the document tab column, and may further determine what the remaining width of the document tab that is not yet displayed in the document tab column is, so that how to display the document tab of the document to be opened may be determined according to the remaining width.
Specifically, the electronic device may first obtain the second width of the displayed document tab in the document tab column and the total width of the document tab column, and calculate the first remaining width of the document tab column according to the second width of the displayed document tab and the total width of the document tab column.
It should be noted that, when the document to be opened is the first opened document, the electronic device may obtain that the second width of the displayed document tab in the document tab column is 0, and the first remaining width of the document tab column is the total width of the document tab column.
S103, judging whether the first width of the document label of the document to be opened is larger than the first residual width; if not, executing step S104; if yes, go to step S105.
After the electronic device obtains the first width of the document tag of the document to be opened and the first remaining width of the document tag column, the electronic device may determine whether the first width of the document tag of the document to be opened is greater than the first remaining width.
If the first width of the document tag of the document to be opened is smaller than or equal to the first remaining width, it indicates that the current document tag column is not occupied, and the document tag of the document to be opened may be displayed with the first width.
If the first width of the document tag of the document to be opened is greater than the first remaining width, it indicates that the document tag of the document to be opened cannot be displayed in the first width in the current document tag column.
S104, displaying the document label of the document to be opened in the document label column based on the first width.
When the electronic device judges that the first width of the document tag of the document to be opened is less than or equal to the first remaining width, the current document tag column is not occupied, and in this case, the electronic device may not process the document tag of the displayed document or the document tag of the document to be opened, and directly display the document tag of the document to be opened in the document tag column.
In one implementation, the electronic device may directly display a document tab of a document to be opened in a document tab field at a first width.
It will be appreciated that the number of characters contained in the document name is typically different for each document, and thus the first width corresponding to the document tag may be different for each document. In this case, if the document tag of each document is displayed in the document tag column with the corresponding first width, the width of each document tag may be inconsistent in the document tag column, resulting in poor document tag display effect.
Therefore, alternatively or additionally, in the embodiment of the present invention, the electronic device may preset a default width (e.g., 200px, 300px, etc.), and display the document tab of the document with the first width smaller than or equal to the default width in the document tab column with the default width as much as possible. Moreover, when displaying the document tag with the first width larger than the default width, in order to avoid that the document tag of the document occupies too large a position and affects the display of other document tags, the electronic device may further preset a maximum width (e.g., 400px, 435px, etc.).
Specifically, after the electronic device obtains the first width of the document tag of the document to be opened, it may be determined whether the first width is greater than the default width, and if so, it indicates that the complete name of the document to be opened cannot be displayed if the document tag of the document to be opened is displayed with the default width, and therefore, the document tag of the document to be opened may not be displayed in the document tag column with the default width. In this case, the electronic device may further determine whether a first width of a document tab of the document to be opened is greater than a predetermined maximum width; if yes, compressing the document tag of the document to be opened, and displaying the compressed document tag of the document to be opened in a document tag column in the maximum width; if not, the document tab of the document to be opened may be displayed in the document tab column in the first width.
In the embodiment of the invention, when compressing the document tag of the document to be opened, the electronic device may delete the suffix displayed in the document tag of the document, then compress the document tag from the middle of the document tag, and the compressed part in the middle of the document tag may be replaced by an ellipsis until compressing the width of the document tag to the maximum width.
When the electronic equipment judges that the first width of the document tag of the document to be opened is smaller than or equal to the default width, the electronic equipment indicates that the complete name of the document to be opened can be displayed if the document tag of the document to be opened is displayed in the default width. At this time, the electronic device needs to further determine whether the first remaining width of the document tab field is greater than the default width, so as to determine whether the document tab of the document to be opened can be displayed with the default width; if so, the document tab of the document to be opened may be displayed in the document tab bar with a default width; if not, the document tag of the document to be opened cannot be displayed in the document tag column in the default width, and at this time, the electronic device may display the document tag of the document to be opened in the document tag column in the first width.
Referring to fig. 2, a schematic diagram of the display effect of each document tag when the document tag column is not full is shown. As shown in fig. 2, when the default width is 200px and the maximum width is 435px, the first width of the document tab of the documents named "document 73" and "document standard" is less than 200px, and the two document tabs may be displayed in the document tab column with a width of 200 px; a document tab named "a document having a first width 399px that is greater than the default width 200px by less than the maximum width 435px," may be displayed in the document tab bar with a first width 399 px; the first width of the document tag of a document whose name is "this is a file name to be compressed to compress compressed to maximum width 435 px" is 450 px.
S105, compressing the displayed document tags and/or the document tags of the document to be opened, and displaying the document tags of the document to be opened in the document tag column.
When the electronic device determines that the first width of the document tag of the document to be opened is greater than the first remaining width, it may indicate that the document tag of the document to be opened cannot be displayed in the first width in the current document tag column.
As described above, among the document tabs displayed in the document tab column, there may be a document tab displayed with a default width, and the first width corresponding to the document tab may be smaller than the default width. In this case, there are spare positions in these document tags. Therefore, when the electronic device compresses each document tag, the electronic device may compress the part of the document tag first.
Specifically, the electronic device may first obtain each first document tag whose width of the displayed document tag in the document tag column is smaller than a predetermined default width, calculate an actual width corresponding to each first document tag according to a name of each first document tag, and then adjust the width of each first document tag to the actual width corresponding to the document tag.
Because the actual width corresponding to each first document may only be equal to or less than the default width, the remaining width of the document tab column may be increased after the width of the document tab of each first document is adjusted to the corresponding actual width. At this time, the electronic device may obtain a third width of the displayed document tag in the current document tag column according to the adjusted width of each document tag, and calculate a second remaining width of the document tag column according to the third width of the displayed document tag and the total width of the document tag column. And further judging whether the first width of the document tag of the document to be opened is larger than the second remaining width, if not, indicating that the document tag of the document to be opened can be displayed in the document tag column with the first width corresponding to the document to be opened, so that the electronic equipment can display the document tag of the document to be opened in the document tag column.
If the first width of the document tag of the document to be opened is greater than the second remaining width, it may be indicated that the document tag of the document to be opened still cannot be displayed in the first width in the current document tag column.
Specifically, the electronic device may delete suffixes displayed in the displayed document tags and the document tag of the document to be opened, calculate a target width corresponding to the document tag of the document to be opened after the suffix is deleted, then obtain a fourth width of the displayed document tag in the current document tag column, and calculate a third remaining width of the document tag column according to the fourth width of the displayed document tag and the total width of the document tag column.
Further, the electronic device may determine whether the target width of the document tag of the document to be opened is greater than the third remaining width, and if not, it indicates that the document tag of the document to be opened may be displayed in the document tag column at the target width corresponding to the document to be opened.
If the target width of the document tag of the document to be opened is greater than the third remaining width, it may be indicated that the document tag of the document to be opened still cannot be displayed in the target width in the current document tag column, in this case, the electronic device may further compress the content of each displayed document tag and the content of the document tag of the document to be opened, and display the compressed document tag of the document to be opened in the document tag column.
Specifically, when compressing the content of each displayed document tag and the content of the document tag of the document to be opened, the electronic device may calculate a compression ratio for compressing the content of the document tag of each document according to the total number of the displayed document tags in the current document tag column, the total width of the document tag column, and the third remaining width, and then compress the content of each displayed document tag and the content of the document tag of the document to be opened according to the compression ratio.
For example, the compression ratio X may be calculated according to the following formula:
Figure BDA0000920593070000131
wherein N is a third remaining width; n is the total number of the displayed document labels in the current document label column; l is the total width of the document tab.
Specifically, when the content of each displayed document tag and the content of the document tag of the document to be opened are compressed according to the calculated compression ratio, each document tag may be compressed as a whole according to the compression ratio. In this case, the document name corresponding to each document can be displayed in each document tag.
When the document tags are compressed in their entirety at a compression ratio, although the document names corresponding to the documents are still displayed in the document tags, the document names of the documents may be compressed, which may make the document names unclear.
Therefore, optionally, in the embodiment of the present invention, when compressing the content of each displayed document tag and the content of the document tag of the document to be opened, the compression may be started from the middle of the document name displayed in each document tag. For example, the middle character of the document name may be deleted or replaced with an ellipsis.
Referring to fig. 3(a) -3(c), schematic diagrams of processes for compressing the document tags shown in fig. 2 are shown.
As shown in fig. 3(a), when compressing each document tag, the document tag of the document named "document 73" may be first compressed to its corresponding actual width 110px, and the document tag of the document named "document standard" may be first compressed to its corresponding actual width 127 px.
As shown in fig. 3(b), when the document tags of the documents to be opened cannot be displayed after the two document tags are compressed to the respective actual widths, the electronic device may delete the document tags displayed in the document tag column and the suffixes displayed in the document tags of the documents to be opened, resulting in the document tags containing only the names of the documents, and when the first width of the document tag of the document to be opened, which is named "document 144", is smaller than the remaining width of the document tag column, the electronic device may display the document tag in the document tag column.
As shown in fig. 3(c), when the name of the document to be opened is "place of fifth document tag", the first width of the document tag is large, the document tag displayed in the document tag column and the suffix displayed in the document tag of the document to be opened are deleted and the document tag of the document to be opened cannot be displayed, the electronic device may compress the document tag displayed in the document tag column and the document tag of the document to be opened according to the calculated compression ratio, and display the document tag of the document to be opened, which is named "place of fifth document tag", in the document tag column.
Further, in the embodiment of the present invention, in order to enable the user to clearly view the document name displayed in each document tag after compressing each document tag, the electronic device may preset a minimum width. After compressing the content of each displayed document tag and the content of the document tag of the document to be opened, the electronic device may determine whether there is a document tag whose width is smaller than a predetermined minimum width; if so, hiding the document tag of at least one document which is opened earliest, and then displaying the document tag of the compressed document to be opened in the document tag column.
The embodiment of the invention provides a document tag display method for WPS, which can correspondingly display each document tag according to the width of each document tag, but not display all document tags with the same width, so that a user can see the name of each document, and the document switching efficiency can be improved when switching documents.
Corresponding to the above method embodiment, the embodiment of the present invention also provides a corresponding device embodiment.
Fig. 4 is a document tag display apparatus for WPS, applied to an electronic device, according to an embodiment of the present invention, where the apparatus includes:
the determining module 410 is configured to determine, when an operation of opening any document input by a user is received, a first width of a document tag of the document to be opened according to a name of the document to be opened;
a calculating module 420, configured to obtain a second width of a displayed document tag in a document tag column and a total width of the document tag column, and calculate a first remaining width of the document tag column according to the second width of the displayed document tag and the total width of the document tag column;
a judging module 430, configured to judge whether a first width of a document tag of the document to be opened is greater than the first remaining width;
a first executing module 440, configured to, when the determining result of the determining module is yes, compress each displayed document tag and/or the document tag of the document to be opened, and display the document tag of the document to be opened in the document tag column;
a second executing module 450, configured to, when the determining module determines that the document tab is not opened, display the document tab of the document to be opened in the document tab column based on the first width.
Embodiments of the present invention provide a document tag display apparatus for a WPS, which can display document tags according to their widths, instead of displaying all document tags with the same width, so that a user can see the name of each document, and document switching efficiency can be improved when switching documents.
Further, the second executing module 450 includes:
a first determining submodule (not shown in the figure) for determining whether the first width is greater than a preset default width;
a first display sub-module (not shown in the figure) for judging whether the first width is larger than a predetermined maximum width when the judgment result of the first judgment sub-module is yes; if yes, compressing the width of the document tag of the document to be opened to the maximum width and displaying the width in the document tag column; if not, displaying the document tag of the document to be opened in the document tag column with the first width;
a second display sub-module (not shown in the figure), configured to determine whether the first remaining width is greater than the default width when the determination result of the first determining sub-module is negative; if so, displaying the document tag of the document to be opened in the document tag column with the default width; and if not, displaying the document tag of the document to be opened in the document tag column with the first width.
Further, the first executing module 440 includes:
an obtaining sub-module (not shown in the figure) for obtaining each first document tag whose width of the displayed document tag in the document tag column is smaller than a predetermined default width, and calculating an actual width corresponding to each first document tag according to the name of each first document tag;
an adjusting submodule (not shown in the figure) for adjusting the width of each first document tag to its corresponding actual width;
a calculating sub-module (not shown in the figure) configured to obtain a third width of a displayed document tag in a current document tag column according to the adjusted width of the displayed document tag, and calculate a second remaining width of the document tag column according to the third width of the displayed document tag and the total width of the document tag column;
a second judging sub-module (not shown in the figure) for judging whether the first width of the document tag of the document to be opened is larger than the second remaining width;
a third display sub-module (not shown in the figure), configured to, when the determination result of the second determination sub-module is yes, compress each displayed document tag and the document tag of the document to be opened, and display the document tag of the document to be opened in the document tag column;
a fourth display sub-module (not shown in the figure), configured to display the document tag of the document to be opened in the document tag column based on the first width when the second determination sub-module determines that the document tag is not the document tag.
Further, the third display sub-module includes:
a deleting unit (not shown in the figure) for deleting suffixes displayed in the displayed document tags and the document tags of the documents to be opened, and calculating a target width corresponding to the document tags of the documents to be opened after the suffixes are deleted and a fourth width of each displayed document tag;
a calculating unit (not shown in the figure) for calculating a third remaining width of the document tab bar according to the fourth width of each of the displayed document tabs and the total width of the document tab bar;
a judging unit (not shown in the figure) for judging whether the target width of the document tag of the document to be opened is larger than the third remaining width;
a compressing unit (not shown in the figure) for compressing the content of each displayed document tag and the content of the document tag of the document to be opened and displaying the compressed document tag of the document to be opened in the document tag column when the judging result of the judging unit is yes;
a display unit (not shown in the figure) for displaying the document label of the document to be opened in the document label column with the target width when the judgment result of the judgment unit is negative.
Further, the compression unit includes:
a calculating subunit (not shown in the figure), configured to calculate, according to the total number of displayed document tags in the current document tag column, the total width of the document tag column, and the third remaining width, a compression ratio for compressing the content of the document tag of each document;
a compressing subunit (not shown in the figure) for compressing the content of each displayed document tag and the content of the document tag of the document to be opened according to the compression ratio.
Further, the computing subunit is specifically configured to:
calculating the compression ratio X according to the following formula:
Figure BDA0000920593070000171
wherein N is the third remaining width; the n is the total number of the displayed document tags in the current document tag column; and L is the total width of the document label bar.
Further, the compressing unit is further configured to compress the content of each displayed document tag and the content of the document tag of the document to be opened, and then determine whether a document tag having a width smaller than a predetermined minimum width exists; if so, the document tag of the at least one document that was opened earliest is hidden.
Further, the second executing module 450 is specifically configured to:
and displaying the document tag of the document to be opened in the document tag column with the first width.
The embodiment of the invention provides a document tag display method and device for WPS (Wireless personal Phone System), which are applied to electronic equipment and comprise the following steps: when receiving an operation of opening any document input by a user, determining a first width of a document tag of the document to be opened according to the name of the document to be opened; obtaining a second width of a displayed document label in a document label column and a total width of the document label column, and calculating a first remaining width of the document label column according to the second width of the displayed document label and the total width of the document label column; judging whether the first width of the document label of the document to be opened is larger than the first residual width; if so, compressing the displayed document tags and/or the document tags of the document to be opened, and displaying the document tags of the document to be opened in the document tag column. If not, displaying the document tag of the document to be opened in the document tag column based on the first width. The embodiment of the invention can correspondingly display each document label according to the width of each document label, but not display all document labels with the same width, thereby enabling a user to see the name of each document and improving the document switching efficiency when switching the documents.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (16)

1. A document tag display method for a word editing system (WPS) is applied to an electronic device and comprises the following steps:
when receiving an operation of opening any document input by a user, determining a first width of a document tag of the document to be opened according to the name of the document to be opened;
obtaining a second width of a displayed document label in a document label column and a total width of the document label column, and calculating a first remaining width of the document label column according to the second width of the displayed document label and the total width of the document label column;
judging whether the first width of the document label of the document to be opened is larger than the first residual width;
if so, compressing the displayed document tags and/or the document tags of the document to be opened, and displaying the document tags of the document to be opened in the document tag column;
if not, displaying the document tag of the document to be opened in the document tag column based on the first width;
compressing the displayed document tags and/or the document tags of the document to be opened, and displaying the document tags of the document to be opened in the document tag column, including:
obtaining each first document label of which the width of the displayed document label is smaller than the preset default width in a document label column, and calculating the actual width corresponding to each first document label according to the name of each first document label;
for each first document tag, adjusting the width of the first document tag to be the corresponding actual width;
obtaining a third width of a displayed document label in a current document label column according to the adjusted width of the displayed document label, and calculating a second remaining width of the document label column according to the third width of the displayed document label and the total width of the document label column;
judging whether the first width of the document label of the document to be opened is larger than the second remaining width;
if yes, compressing the displayed document tags and the document tags of the document to be opened, and displaying the document tags of the document to be opened in the document tag column.
2. The method of claim 1, wherein displaying the document tab of the document to be opened in the document tab bar based on the first width comprises:
judging whether the first width is larger than a preset default width or not;
if yes, judging whether the first width is larger than a preset maximum width; if yes, compressing the width of the document tag of the document to be opened to the maximum width and displaying the width in the document tag column; if not, displaying the document tag of the document to be opened in the document tag column with the first width;
if not, judging whether the first residual width is larger than the default width or not; if so, displaying the document tag of the document to be opened in the document tag column with the default width; and if not, displaying the document tag of the document to be opened in the document tag column with the first width.
3. The method according to claim 2, wherein compressing each of the displayed document tags and/or the document tags of the document to be opened and displaying the document tags of the document to be opened in the document tag column, further comprises:
when the first width of the document tag of the document to be opened is not larger than the second remaining width, displaying the document tag of the document to be opened in the document tag column based on the first width.
4. The method according to claim 3, wherein the compressing each of the displayed document tags and the document tags of the document to be opened and displaying the document tags of the document to be opened in the document tag column comprises:
deleting suffixes displayed in the displayed document tags and the document tags of the documents to be opened, and calculating a target width corresponding to the document tags of the documents to be opened after the suffixes are deleted and a fourth width of each displayed document tag;
calculating a third remaining width of the document tab bar according to the fourth width of each displayed document tab and the total width of the document tab bar;
judging whether the target width of the document label of the document to be opened is larger than the third remaining width;
if so, compressing the content of each displayed document tag and the content of the document tag of the document to be opened, and displaying the compressed document tag of the document to be opened in the document tag column;
if not, displaying the document label of the document to be opened in the document label column with the target width.
5. The method of claim 4, wherein compressing the content of each displayed document tab and the content of the document tab of the document to be opened comprises:
calculating a compression ratio for compressing the content of the document tag of each document according to the total number of the displayed document tags in the current document tag column, the total width of the document tag column and the third residual width;
and compressing the content of each displayed document tag and the content of the document tag of the document to be opened according to the compression ratio.
6. The method of claim 5, wherein calculating a compression ratio for compressing the content of the document tag of each document according to the total number of document tags displayed in the current document tag column, the total width of the document tag column, and the third remaining width comprises:
calculating the compression ratio X according to the following formula:
Figure FDA0002693095410000031
wherein N is the third remaining width; the n is the total number of the displayed document tags in the current document tag column; and L is the total width of the document label bar.
7. The method according to any one of claims 4-6, wherein after compressing the content of each of the displayed document tags and the content of the document tag of the document to be opened, the method further comprises:
judging whether a document tag with the width smaller than a preset minimum width exists; if so, the document tag of the at least one document that was opened earliest is hidden.
8. The method of claim 1, wherein displaying the document tab of the document to be opened in the document tab bar based on the first width comprises:
and displaying the document tag of the document to be opened in the document tag column with the first width.
9. A document tag display device for a word editing system (WPS) is applied to an electronic device, and the device comprises:
the determining module is used for determining the first width of a document tag of a document to be opened according to the name of the document to be opened when receiving an operation of opening any document input by a user;
the calculation module is used for obtaining the second width of the displayed document label in the document label column and the total width of the document label column, and calculating the first residual width of the document label column according to the second width of the displayed document label and the total width of the document label column;
the judging module is used for judging whether the first width of the document label of the document to be opened is larger than the first residual width;
the first execution module is used for compressing each displayed document tag and/or document tag of the document to be opened and displaying the document tag of the document to be opened in the document tag column when the judgment result of the judgment module is yes;
the second execution module is used for displaying the document label of the document to be opened in the document label column based on the first width when the judgment result of the judgment module is negative;
the first execution module includes:
the obtaining submodule is used for obtaining each first document tag of which the width of the displayed document tag is smaller than the preset default width in the document tag column and calculating the actual width corresponding to each first document tag according to the name of each first document tag;
the adjusting submodule is used for adjusting the width of each first document tag to be the corresponding actual width;
the calculation submodule is used for obtaining the third width of the displayed document label in the current document label column according to the adjusted width of the displayed document label, and calculating the second residual width of the document label column according to the third width of the displayed document label and the total width of the document label column;
the second judgment submodule is used for judging whether the first width of the document tag of the document to be opened is larger than the second remaining width;
and a third display sub-module, configured to, when the determination result of the second determination sub-module is yes, compress the displayed document tags and the document tags of the to-be-opened document, and display the document tags of the to-be-opened document in the document tag column.
10. The apparatus of claim 9, wherein the second execution module comprises:
the first judgment submodule is used for judging whether the first width is larger than a preset default width or not;
the first display submodule is used for judging whether the first width is larger than the preset maximum width or not when the judgment result of the first judgment submodule is yes; if yes, compressing the width of the document tag of the document to be opened to the maximum width and displaying the width in the document tag column; if not, displaying the document tag of the document to be opened in the document tag column with the first width;
the second display submodule is used for judging whether the first residual width is larger than the default width or not when the judgment result of the first judgment submodule is negative; if so, displaying the document tag of the document to be opened in the document tag column with the default width; and if not, displaying the document tag of the document to be opened in the document tag column with the first width.
11. The apparatus of claim 10, wherein the first execution module further comprises:
and the fourth display sub-module is used for displaying the document tag of the document to be opened in the document tag column based on the first width when the judgment result of the second judgment sub-module is negative.
12. The apparatus of claim 11, wherein the third display sub-module comprises:
a deleting unit, configured to delete suffixes displayed in the displayed document tags and the document tag of the to-be-opened document, and calculate a target width corresponding to the document tag of the to-be-opened document after the suffix is deleted and a fourth width of each displayed document tag;
a calculating unit, configured to calculate a third remaining width of the document tab column according to a fourth width of each displayed document tab and a total width of the document tab column;
the judging unit is used for judging whether the target width of the document label of the document to be opened is larger than the third remaining width;
the compression unit is used for compressing the content of each displayed document tag and the content of the document tag of the document to be opened and displaying the compressed document tag of the document to be opened in the document tag column when the judgment result of the judgment unit is yes;
and the display unit is used for displaying the document label of the document to be opened in the document label column in the target width when the judgment result of the judgment unit is negative.
13. The apparatus of claim 12, wherein the compression unit comprises:
a calculating subunit, configured to calculate, according to the total number of displayed document tags in the current document tag column, the total width of the document tag column, and the third remaining width, a compression ratio for compressing the content of the document tag of each document;
and the compression subunit is used for compressing the content of each displayed document tag and the content of the document tag of the document to be opened according to the compression ratio.
14. The apparatus according to claim 13, wherein the computing subunit is specifically configured to:
calculating the compression ratio X according to the following formula:
Figure FDA0002693095410000061
wherein N is the third remaining width; the n is the total number of the displayed document tags in the current document tag column; and L is the total width of the document label bar.
15. The apparatus according to any of claims 12-14, wherein the compressing unit is further configured to compress the content of each displayed document tag and the content of the document tag of the document to be opened, and then determine whether there is a document tag having a width smaller than a predetermined minimum width; if so, the document tag of the at least one document that was opened earliest is hidden.
16. The apparatus of claim 9, wherein the second execution module is specifically configured to:
and displaying the document tag of the document to be opened in the document tag column with the first width.
CN201610074175.6A 2016-02-02 2016-02-02 Document tag display method and device for WPS Active CN107025210B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610074175.6A CN107025210B (en) 2016-02-02 2016-02-02 Document tag display method and device for WPS

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610074175.6A CN107025210B (en) 2016-02-02 2016-02-02 Document tag display method and device for WPS

Publications (2)

Publication Number Publication Date
CN107025210A CN107025210A (en) 2017-08-08
CN107025210B true CN107025210B (en) 2021-01-22

Family

ID=59524571

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610074175.6A Active CN107025210B (en) 2016-02-02 2016-02-02 Document tag display method and device for WPS

Country Status (1)

Country Link
CN (1) CN107025210B (en)

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7596760B2 (en) * 2005-04-07 2009-09-29 Microsoft Corporation System and method for selecting a tab within a tabbed browser
US20070094342A1 (en) * 2005-10-24 2007-04-26 Bostick James E Detachable control window for instant messaging chats
JP2009016942A (en) * 2007-06-29 2009-01-22 Toshiba Corp Content display apparatus
US8001482B2 (en) * 2007-12-21 2011-08-16 International Business Machines Corporation Method of displaying tab titles
US9378297B2 (en) * 2011-03-07 2016-06-28 Microsoft Technology Licensing, Llc Task-based address bar and tabs scaling
CN102945265B (en) * 2012-10-24 2016-07-06 北京奇虎科技有限公司 Label rendering method in a browser and device
CN103049507A (en) * 2012-12-12 2013-04-17 北京奇虎科技有限公司 Label adding device and method for browser
CN103064683A (en) * 2013-02-19 2013-04-24 福建榕基软件股份有限公司 Method and device for custom layout of multiple tabs under WEB environment
CN104020924B (en) * 2014-05-21 2016-08-31 小米科技有限责任公司 Label creation method, device and terminal
CN104281644A (en) * 2014-08-22 2015-01-14 广州三星通信技术研究有限公司 Filename information display method and device
CN104866318B (en) * 2015-06-05 2018-07-13 北京金山安全软件有限公司 Method and device for displaying label pages in multiple windows

Also Published As

Publication number Publication date
CN107025210A (en) 2017-08-08

Similar Documents

Publication Publication Date Title
CN106484266B (en) Text processing method and device
US8302016B2 (en) Display apparatus
CN106325687B (en) Method and terminal for calling program
US20120221969A1 (en) Scrollable list navigation using persistent headings
US20080163065A1 (en) Using a light source to indicate navigation spots on a web page
CN112099685B (en) Notification message display control method and device, electronic equipment and readable storage medium
US20110078272A1 (en) Communication terminal device and communication system using same
CN106445321A (en) Document content display method and terminal
US20120191756A1 (en) Terminal having searching function and method for searching using data saved in clipboard
CN111897468B (en) Message processing method and device, electronic equipment and readable storage medium
CN112988006A (en) Display method, display device, electronic equipment and storage medium
CN107256116B (en) Page switching processing method and device, user terminal and readable storage medium
CN113157753A (en) Display method and device and electronic equipment
CN112181253A (en) Information display method and device and electronic equipment
US10895962B2 (en) Apparatus and method for facilitating browser navigation
CN104657341A (en) Terminal
CN113253883A (en) Application interface display method and device and electronic equipment
CN113114845A (en) Notification message display method and device
CN107025210B (en) Document tag display method and device for WPS
CN112698734B (en) Candidate word display method and device and electronic equipment
CN111610917B (en) Display method, display device and electronic equipment
CN111796736B (en) Application sharing method and device and electronic equipment
CN114077371A (en) Information display method and device, electronic equipment and storage medium
CN112764551A (en) Vocabulary display method and device and electronic equipment
CN112286613A (en) Interface display method and interface display device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant